public ActionResult Confirm(PersonalScheduleForm form) { return form.PersonalSchedule == null ? RedirectTo<PersonalController>(a => a.List()) : View(form); }
public ActionResult Edit([PRGInRoute] int? id, PersonalScheduleForm form) { if (!id.HasValue) return RedirectTo<PersonalController>(a => a.List()); PersonalSchedule schedule = form.PersonalSchedule ?? Get<IPersonalScheduleRepository>().GetById(id.Value); if (schedule == null) return RedirectTo<PersonalController>(a => a.List()); form.PersonalSchedule = schedule; form.Parameters = Get<IParameterRepository>().GetAll(); form.Patients = Get<IPatientRepository>().GetAll(); return View(form); }
public ActionResult AddSubmit(PersonalScheduleForm form) { if (ModelState.IsValid) { Get<IPersonalScheduleRepository>().Save(form.PersonalSchedule); form.Message = "Расписание отредактировано"; return RedirectTo<PersonalController>(a => a.Confirm(form)); } return RedirectTo<PersonalController>(a => a.Add(form)); }
public ActionResult Delete(int? id, bool? confirm) { if (!id.HasValue) return RedirectTo<PersonalController>(a => a.List()); if (!confirm.HasValue) { PersonalSchedule schedule = Get<IPersonalScheduleRepository>().GetById(id.Value); if (schedule == null) return RedirectTo<PersonalController>(a => a.List()); var form = new PersonalScheduleForm { Message = "Точно удалить это расписание", PersonalSchedule = schedule }; return View(form); } if (confirm.Value) Get<IPersonalScheduleRepository>().DeleteById(id.Value); return RedirectTo<PersonalController>(a => a.List()); }
public ActionResult Add(PersonalScheduleForm form) { form.Parameters = Get<IParameterRepository>().GetAll(); form.Patients = Get<IPatientRepository>().GetAll(); return View(form); }
public ActionResult Show(int? id) { if (!id.HasValue) return RedirectTo<PersonalController>(a => a.List()); PersonalSchedule schedule = Get<IPersonalScheduleRepository>().GetById(id.Value); if (schedule == null) return RedirectTo<PersonalController>(a => a.List()); var form = new PersonalScheduleForm { PersonalSchedule = schedule }; return View(form); }