示例#1
0
 public ActionResult Confirm(DoctorForm form)
 {
     return
         form.Doctor == null
             ? RedirectTo<DoctorController>(a => a.List())
             : View(form);
 }
示例#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);
 }
示例#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));
 }
示例#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());
 }
示例#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));
 }
示例#6
0
 public ActionResult Add(DoctorForm form)
 {
     form.Specialties = Get<ISpecialtyRepository>().GetAll();
     return View(form);
 }
示例#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);
 }