예제 #1
0
 public ActionResult Confirm(PersonalScheduleForm form)
 {
     return
         form.PersonalSchedule == null
             ? RedirectTo<PersonalController>(a => a.List())
             : View(form);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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));
 }
예제 #4
0
 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());
 }
예제 #5
0
 public ActionResult Add(PersonalScheduleForm form)
 {
     form.Parameters = Get<IParameterRepository>().GetAll();
     form.Patients = Get<IPatientRepository>().GetAll();
     return View(form);
 }
예제 #6
0
 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);
 }