public ActionResult SaveNewTeacher(Teacher teacher) { teacherService = new TeacherService(); subjectService = new SubjectService(); staffService = new StaffService(); // adds it to the teacher's list and the staff's list teacherService.AddAndSaveNewTeacher(teacher); subjectService.ChangeTeacherInAListaOfSubjects(hireTeacherSingleton.getSubjects(), teacher); return(RedirectToAction("Index")); }
public ActionResult Create(Teacher teacher) { if (!ModelState.IsValid) { return(RedirectToAction("Index")); } if (teacher != null) { teacherService = new TeacherService(); teacherService.AddAndSaveNewTeacher(teacher); return(RedirectToAction("Index")); } return(View(teacher)); }