public async Task <ActionResult> Edit(int id, IFormCollection collection, TeacherEducationsVM vm) { try { // TODO: Add update logic here if (!ModelState.IsValid) { return(View(new TeacherEducationsVM(educationRepo, vm.Teacher))); } await teacherRepo.Update(vm.Teacher); teacherRepo.RemoveEducation(vm.Teacher.Id); teacherRepo.AddEducationsToTeacher(vm.Teacher.Id, vm.SelectedEducationsString); return(RedirectToAction(nameof(IndexAsync))); } catch (Exception ex) { return(View(new TeacherEducationsVM(educationRepo, vm.Teacher))); } }
public Teacher Update(Teacher teacher) { return(_teacherRepo.Update(teacher)); }