public IActionResult Create(Aluno a) { if (ModelState.IsValid) { if (_alunoDao.Cadastrar(a)) { return(RedirectToAction(nameof(Index))); } } return(View(a)); }
public IActionResult Cadastrar([FromBody] Aluno a) { if (ModelState.IsValid) { if (_alunoDAO.Cadastrar(a)) { return(Created("", a)); } return(Conflict(new { msg = "Esse aluno já consta no sistema!" })); } return(BadRequest(ModelState)); }