コード例 #1
0
        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)));
            }
        }
コード例 #2
0
 public Teacher Update(Teacher teacher)
 {
     return(_teacherRepo.Update(teacher));
 }