public ActionResult Add(StudentSet student) { var studentExist = _applicationService.GetStudentByLogin(student.Login); if (studentExist == null) { if (student.Password == null || student.Login == null) { ModelState.AddModelError("Login", "Login and password are required"); return(View(student)); } _applicationService.AddStudent(student); var studentListViewModel = _applicationService.GetStudentListViewModelByGroupId(student.Group_Id.ToString()); return(View("StudentList", studentListViewModel)); } else { ModelState.AddModelError("Login", "This login exists"); return(View(student)); } }