Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teste/weksslei #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1,011 changes: 1,011 additions & 0 deletions vestibular-info/.vs/vestibular-info/config/applicationhost.config

Large diffs are not rendered by default.

Binary file added vestibular-info/.vs/vestibular-info/v16/.suo
Binary file not shown.
Binary file not shown.
Binary file added vestibular-info/.vs/vestibular-info/v17/.suo
Binary file not shown.
144 changes: 144 additions & 0 deletions vestibular-info/.vs/vestibular-info/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|c:\\users\\wekss\\source\\repos\\teste-desenvolvedor-.net\\vestibular-info\\controllers\\inscricaocontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|solutionrelative:controllers\\inscricaocontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|c:\\users\\wekss\\source\\repos\\teste-desenvolvedor-.net\\vestibular-info\\data\\vestibularcontexthelpers.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|solutionrelative:data\\vestibularcontexthelpers.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|c:\\users\\wekss\\source\\repos\\teste-desenvolvedor-.net\\vestibular-info\\data\\vestibularcontext.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|solutionrelative:data\\vestibularcontext.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|c:\\users\\wekss\\source\\repos\\teste-desenvolvedor-.net\\vestibular-info\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|c:\\users\\wekss\\source\\repos\\teste-desenvolvedor-.net\\vestibular-info\\models\\lead.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|solutionrelative:models\\lead.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|c:\\users\\wekss\\source\\repos\\teste-desenvolvedor-.net\\vestibular-info\\controllers\\processoselectivocontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{7A937BAD-A887-437E-8C38-620606636BC5}|vestibular-info.csproj|solutionrelative:controllers\\processoselectivocontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 5,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Bookmark",
"Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
},
{
"$type": "Bookmark",
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "VestibularContextHelpers.cs",
"DocumentMoniker": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Data\\VestibularContextHelpers.cs",
"RelativeDocumentMoniker": "Data\\VestibularContextHelpers.cs",
"ToolTip": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Data\\VestibularContextHelpers.cs",
"RelativeToolTip": "Data\\VestibularContextHelpers.cs",
"ViewState": "AQIAABYAAAAAAAAAAAAwwB4AAAAbAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-07-31T01:13:41.963Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "VestibularContext.cs",
"DocumentMoniker": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Data\\VestibularContext.cs",
"RelativeDocumentMoniker": "Data\\VestibularContext.cs",
"ToolTip": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Data\\VestibularContext.cs",
"RelativeToolTip": "Data\\VestibularContext.cs",
"ViewState": "AQIAACgAAAAAAAAAAAAtwGYAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-07-31T00:58:16.4Z"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "InscricaoController.cs",
"DocumentMoniker": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Controllers\\InscricaoController.cs",
"RelativeDocumentMoniker": "Controllers\\InscricaoController.cs",
"ToolTip": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Controllers\\InscricaoController.cs",
"RelativeToolTip": "Controllers\\InscricaoController.cs",
"ViewState": "AQIAAFEAAAAAAAAAAAAkwEIAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-07-31T00:37:28.464Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "Lead.cs",
"DocumentMoniker": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Models\\Lead.cs",
"RelativeDocumentMoniker": "Models\\Lead.cs",
"ToolTip": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Models\\Lead.cs",
"RelativeToolTip": "Models\\Lead.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAsAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-07-31T00:36:08.588Z"
},
{
"$type": "Document",
"DocumentIndex": 6,
"Title": "Microsoft.Common.CurrentVersion.targets",
"DocumentMoniker": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
"RelativeDocumentMoniker": "..\\..\\..\\..\\..\\..\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
"ToolTip": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
"RelativeToolTip": "..\\..\\..\\..\\..\\..\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
"ViewState": "AQIAAGkUAAAAAAAAAAAUwKEUAAALAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003801|",
"WhenOpened": "2024-07-30T22:04:09.36Z"
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Program.cs",
"RelativeDocumentMoniker": "Program.cs",
"ToolTip": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Program.cs",
"RelativeToolTip": "Program.cs",
"ViewState": "AQIAABgAAAAAAAAAAAAwwCkAAAAOAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-07-30T21:36:26.186Z"
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "ProcessoSelectivoController.cs",
"DocumentMoniker": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Controllers\\ProcessoSelectivoController.cs",
"RelativeDocumentMoniker": "Controllers\\ProcessoSelectivoController.cs",
"ToolTip": "C:\\Users\\wekss\\source\\repos\\Teste-Desenvolvedor-.NET\\vestibular-info\\Controllers\\ProcessoSelectivoController.cs",
"RelativeToolTip": "Controllers\\ProcessoSelectivoController.cs",
"ViewState": "AQIAAEgAAAAAAAAAAAAowGQAAAABAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-07-30T21:17:47.533Z"
}
]
}
]
}
]
}
143 changes: 143 additions & 0 deletions vestibular-info/Controllers/InscricaoController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using vestibular_info.Models;
using Vestibular_info.Data;


namespace vestibular_info.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class InscricaoController : ControllerBase
{
private readonly VestibularContext _context;

public InscricaoController(VestibularContext context)
{
_context = context;
}

// GET: api/Inscricao
[HttpGet]
public async Task<ActionResult<IEnumerable<Inscricao>>> GetInscricoes()
{
return await _context.Inscricoes.ToListAsync();
}

// GET: api/Inscricao/5
[HttpGet("{id}")]
public async Task<ActionResult<Inscricao>> GetInscricao(int id)
{
var inscricao = await _context.Inscricoes.FindAsync(id);

if (inscricao == null)
{
return NotFound();
}

return inscricao;
}

// PUT: api/Inscricao/5
[HttpPut("{id}")]
public async Task<IActionResult> PutInscricao(int id, Inscricao inscricao)
{
if (id != inscricao.Id)
{
return BadRequest();
}

_context.Entry(inscricao).State = EntityState.Modified;

try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!InscricaoExists(id))
{
return NotFound();
}
else
{
throw;
}
}

return NoContent();
}

// POST: api/Inscricao
[HttpPost]
public async Task<ActionResult<Inscricao>> PostInscricao(Inscricao inscricao)
{
_context.Inscricoes.Add(inscricao);
await _context.SaveChangesAsync();

return CreatedAtAction("GetInscricao", new { id = inscricao.Id }, inscricao);
}

// DELETE: api/Inscricao/5
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteInscricao(int id)
{
var inscricao = await _context.Inscricoes.FindAsync(id);
if (inscricao == null)
{
return NotFound();
}

_context.Inscricoes.Remove(inscricao);
await _context.SaveChangesAsync();

return NoContent();
}

private bool InscricaoExists(int id)
{
return _context.Inscricoes.Any(e => e.Id == id);
}

//Get api/Inscricao/ByCPF/{cpf}

public async Task<ActionResult<IEnumerable<Inscricao>>> GetInscricaoByCPF(string cpf)
{
var lead = await _context.Leads.FirstOrDefaultAsync(l => l.CPF == cpf);

if(lead == null)
{
return NotFound( new {message = "CPF não encontrado"});
}
var inscricoes = await _context.Inscricoes.Where(i => i.LeadId == lead.Id).ToListAsync();

if (inscricoes.Count == 0)
{
return NotFound(new { message = "Nenhuma inscrição encontrada para este CPF" });
}

return inscricoes;
}

// GET: api/Inscricao/ByOferta/{id}
[HttpGet("ByOferta/{id}")]
public async Task<ActionResult<IEnumerable<Inscricao>>> GetInscricoesByOferta(int id)
{
var oferta = await _context.Ofertas.FindAsync(id);

if (oferta == null)
{
return NotFound(new { message = "Oferta não encontrada" });
}

var inscricoes = await _context.Inscricoes.Where(i => i.OfertaId == id).ToListAsync();

if (inscricoes.Count == 0)
{
return NotFound(new { message = "Nenhuma inscrição encontrada para esta oferta" });
}

return inscricoes;
}
}
}
102 changes: 102 additions & 0 deletions vestibular-info/Controllers/LeadController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using vestibular_info.Models;
using Vestibular_info.Data;


namespace vestibular_info.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class LeadController : ControllerBase
{
private readonly VestibularContext _context;

public LeadController(VestibularContext context)
{
_context = context;
}

// GET: api/Lead
[HttpGet]
public async Task<ActionResult<IEnumerable<Lead>>> GetLeads()
{
return await _context.Leads.ToListAsync();
}

// GET: api/Lead/5
[HttpGet("{id}")]
public async Task<ActionResult<Lead>> GetLead(int id)
{
var lead = await _context.Leads.FindAsync(id);

if (lead == null)
{
return NotFound();
}

return lead;
}

// PUT: api/Lead/5
[HttpPut("{id}")]
public async Task<IActionResult> PutLead(int id, Lead lead)
{
if (id != lead.Id)
{
return BadRequest();
}

_context.Entry(lead).State = EntityState.Modified;

try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!LeadExists(id))
{
return NotFound();
}
else
{
throw;
}
}

return NoContent();
}

// POST: api/Lead
[HttpPost]
public async Task<ActionResult<Lead>> PostLead(Lead lead)
{
_context.Leads.Add(lead);
await _context.SaveChangesAsync();

return CreatedAtAction("GetLead", new { id = lead.Id }, lead);
}

// DELETE: api/Lead/5
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteLead(int id)
{
var lead = await _context.Leads.FindAsync(id);
if (lead == null)
{
return NotFound();
}

_context.Leads.Remove(lead);
await _context.SaveChangesAsync();

return NoContent();
}

private bool LeadExists(int id)
{
return _context.Leads.Any(e => e.Id == id);
}
}
}
Loading