public ActionResult Create(CreateProfessorViewModel professor) { if (!UserIsInRole("Admin")) { return(RedirectToAction("Index", "Home")); } var professorInput = new ProfessorInputRegister { CPF = professor.CPF, Degree = professor.SelectedDegree, Email = professor.Email, FirstName = professor.FirstName, LastName = professor.LastName, Phone = professor.Phone }; var result = _professorCommand.Handle(professorInput); if (!result.IsValid) { foreach (var n in result.Notifications) { ModelState.AddModelError(n.Key, n.Value); } professor.Degrees = GetComboboxDegree(); return(View(professor)); } return(RedirectToAction("Index")); }
// GET: Professor/Create public ActionResult Create() { if (!UserIsInRole("Admin")) { return(RedirectToAction("Index", "Home")); } var professor = new CreateProfessorViewModel { Degrees = GetComboboxDegree() }; return(View(professor)); }