Esempio n. 1
0
 public ActionResult Create(Estudante estudante)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _estudanteRepositorio.InserirEstudante(estudante);
             _estudanteRepositorio.Salvar();
             return(RedirectToAction("Index"));
         }
     }
     catch (DataException)
     {
         ModelState.AddModelError("", "Não foi possível salvar as mudanças. Tente novamente....");
     }
     return(View(estudante));
 }