Exemplo n.º 1
0
 public ActionResult Confirm(PatientForm form)
 {
     return
         form.Patient == null
             ? RedirectTo<PatientsController>(a => a.List())
             : View(form);
 }
Exemplo n.º 2
0
 public ActionResult AddSubmit(PatientForm form)
 {
     if (ModelState.IsValid)
     {
         Get<IPatientRepository>().Save(form.Patient);
         return RedirectTo<PatientsController>(a => a.Confirm(form));
     }
     return RedirectTo<PatientsController>(a => a.Add(form));
 }
Exemplo n.º 3
0
 public ActionResult Edit(int? id, PatientForm form)
 {
     if (!id.HasValue) return RedirectTo<PatientsController>(a => a.List());
     form.Patient = form.Patient ?? Get<IPatientRepository>().GetById(id.Value);
     form.Doctors = Get<IDoctorRepository>().GetAll();
     return
         form.Patient == null
             ? RedirectTo<PatientsController>(a => a.List())
             : View(form);
 }
Exemplo n.º 4
0
 public ActionResult Delete(int? id, bool? confirm)
 {
     if (!id.HasValue) return RedirectTo<PatientsController>(a => a.List());
     if (!confirm.HasValue)
     {
         Patient patient = Get<IPatientRepository>().GetById(id.Value);
         var form = new PatientForm {Patient = patient};
         return
             patient == null
                 ? RedirectTo<PatientsController>(a => a.List())
                 : View(form);
     }
     if (confirm.Value) Get<IPatientRepository>().DeleteById(id.Value);
     return RedirectTo<PatientsController>(a => a.List());
 }
Exemplo n.º 5
0
 public ActionResult Edit(PatientForm form)
 {
     if (ModelState.IsValid)
     {
         Get<IPatientRepository>().Update(form.Patient);
         Get<IAttendingDoctorService>().SetLedDoctorForPatient(form.Patient.Doctor.Id, form.Patient.Id);
         form.Message = "Пациент отредактирован";
         return RedirectTo<PatientsController>(a => a.Confirm(form));
     }
     return RedirectTo<PatientsController>(a => a.Edit(form.Patient.Id, form));
 }
Exemplo n.º 6
0
 public ActionResult Add(PatientForm form)
 {
     form.Patient = form.Patient ?? new Patient();
     form.Doctors = Get<IDoctorRepository>().GetAll();
     return View(form);
 }
Exemplo n.º 7
0
 public ActionResult Show(int? id)
 {
     if (!id.HasValue) return RedirectTo<PatientsController>(a => a.List());
     Patient patient = Get<IPatientRepository>().GetById(id.Value);
     var form = new PatientForm {Patient = patient};
     return
         patient == null
             ? RedirectTo<PatientsController>(a => a.List())
             : View(form);
 }
Exemplo n.º 8
0
 public ActionResult Led(PatientForm form)
 {
     if (ModelState.IsValid)
     {
         Get<IAttendingDoctorService>().SetLedDoctorForPatient(form.Patient.Doctor.Id, form.Patient.Id);
         form.Patient = Get<IPatientRepository>().GetById(form.Patient.Id);
         return RedirectTo<PatientsController>(a => a.Confirm(form));
     }
     return RedirectTo<PatientsController>(a => a.Led(form.Patient.Id, form));
 }
Exemplo n.º 9
0
 public ActionResult Led([PRGInRoute]int? id, PatientForm form)
 {
     if (!id.HasValue) return RedirectTo<PatientsController>(a => a.List());
     Patient patient = Get<IPatientRepository>().GetById(id.Value);
     if (patient == null) return RedirectTo<PatientsController>(a => a.List());
     form.Patient = patient;
     form.Doctors = Get<IDoctorRepository>().GetAll();
     return View(form);
 }