Example #1
0
 public ActionResult Confirm(DoctorForm form)
 {
     return
         form.Doctor == null
             ? RedirectTo<DoctorController>(a => a.List())
             : View(form);
 }
Example #2
0
 public ActionResult Edit(int? id, DoctorForm form)
 {
     if (!id.HasValue) return RedirectTo<DoctorController>(a => a.List());
     form.Doctor = form.Doctor ?? Get<IDoctorRepository>().GetById(id.Value);
     if (form.Doctor == null) return RedirectTo<DoctorController>(a => a.List());
     form.Specialties = DIKernel.Get<ISpecialtyRepository>().GetAll();
     return View(form);
 }
Example #3
0
 public ActionResult AddSubmit(DoctorForm form)
 {
     if (ModelState.IsValid)
     {
         Get<IDoctorRepository>().Save(form.Doctor);
         form.Message = "Доктор добавлен";
         return RedirectTo<DoctorController>(a => a.Confirm(form));
     }
     return RedirectTo<DoctorController>(a => a.Add(form));
 }
Example #4
0
 public ActionResult Delete(int? id, bool? confirm)
 {
     if (!id.HasValue) return RedirectTo<DoctorController>(a => a.List());
     if (!confirm.HasValue)
     {
         Doctor doctor = Get<IDoctorRepository>().GetById(id.Value);
         if (doctor == null) return RedirectTo<DoctorController>(a => a.List());
         var form = new DoctorForm { Doctor = doctor };
         return View(form);
     }
     if (confirm.Value) DIKernel.Get<IDoctorRepository>().DeleteById(id.Value);
     return RedirectTo<DoctorController>(a => a.List());
 }
Example #5
0
 public ActionResult Edit(DoctorForm form)
 {
     if (ModelState.IsValid)
     {
         Get<IDoctorRepository>().Update(form.Doctor);
         form.Message = "Информация о докторе изменена";
         return RedirectTo<DoctorController>(a => a.Confirm(form));
     }
     return RedirectTo<DoctorController>(a => a.Edit(form.Doctor.Id, form));
 }
Example #6
0
 public ActionResult Add(DoctorForm form)
 {
     form.Specialties = Get<ISpecialtyRepository>().GetAll();
     return View(form);
 }
Example #7
0
 public ActionResult Show(int? id)
 {
     if (!id.HasValue) return RedirectTo<DoctorController>(a => a.List());
     Doctor doctor = Get<IDoctorRepository>().GetById(id.Value);
     if (doctor == null) return RedirectTo<DoctorController>(a => a.List());
     var form = new DoctorForm { Doctor = doctor };
     return View(form);
 }