public ActionResult Confirm(PatientForm form) { return form.Patient == null ? RedirectTo<PatientsController>(a => a.List()) : View(form); }
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)); }
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); }
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()); }
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)); }
public ActionResult Add(PatientForm form) { form.Patient = form.Patient ?? new Patient(); form.Doctors = Get<IDoctorRepository>().GetAll(); return View(form); }
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); }
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)); }
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); }