public ActionResult Create(AlunosVM alunos) { try { if (ModelState.IsValid) { uow.GetRepository<Aluno>().Add(alunos.aluno); uow.Save(); var alunosCol = new AlunosVM() { alunos = uow.GetRepository<Aluno>().All() }; return View(alunosCol); } } catch (Exception exc) { return View("CustomError", exc); } return RedirectToAction("Create"); }
// GET: Alunos/Create public ActionResult Create() { AlunosVM alunosVm = new AlunosVM() { alunos = uow.GetRepository<Aluno>().All() }; return View(alunosVm); }