public ActionResult EditSchedule(ScheduleForm form) { if (ModelState.IsValid) { form.WorkWeek.Doctor = Get<IDoctorRepository>().GetById(form.WorkWeek.Doctor.Id); Get<IWorkWeekRepository>().Update(form.WorkWeek); return RedirectTo<DoctorController>(a => a.ShowSchedule(form.WorkWeek.Doctor.Id), "Admin_default"); } return RedirectTo<DoctorController>(a => a.EditSchedule(form.WorkWeek.Doctor.Id, form)); }
public ActionResult ShowSchedule([PRGInRoute]int id) { var form = new ScheduleForm { WorkWeek = Get<IWorkWeekRepository>().GetByDoctorId(id) }; return View("ShowSchedule", form); }
public ActionResult EditSchedule([PRGInRoute]int id, ScheduleForm form) { form.WorkWeek = form.WorkWeek ?? Get<IWorkWeekRepository>().GetByDoctorId(id); return View("EditSchedule", form); }