public ActionResult Edit(int id) { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); Visit visit = LoadMainDoctorDDLOptions(VisitFromId(id)); visit.InitDateTime(); return(View(visit)); }
public ActionResult Details(int id) { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); Patient p = PatientFromId(id); p = LoadAdmissionsList(p); return(View(p)); }
public ActionResult Create() { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); Patient patient = new Patient { DOB = DateTime.Now }; return(View(LoadDDLOptions(patient))); }
public ActionResult Index(string searchBy, string search) { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); if (searchBy == "Telephone") { return(View(ctx.Patients.Where(x => x.Telephone.Contains(search) || search == null).Include(x => x.Doctor))); } else { return(View(ctx.Patients.Where(x => x.Name.StartsWith(search) || search == null).Include(x => x.Doctor))); } }
public ActionResult Create() { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); Visit visit = new Visit { DateAndTime = DateTime.Now }; visit.InitDateTime(); return(View(LoadDDLOptions(visit))); }
public ActionResult DeleteConfirm(int id) { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); try { Patient patient = ctx.Patients.Single(x => x.Id == id); ctx.Patients.Remove(patient); ctx.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Error deleting a patient: " + e.GetBaseException().ToString()); } return(RedirectToAction("Index")); }
public ActionResult DeleteConfirm(int id) { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); try { Doctor doctor = ctx.Doctors.Single(x => x.Id == id); ctx.Doctors.Remove(doctor); ctx.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception e) { //System.Data.SqlClient.SqlException: trying to delete a doctor referenced in a patient/visit System.Diagnostics.Debug.WriteLine("Error deleting a doctor: " + e.GetBaseException().ToString()); } return(RedirectToAction("Index")); }
public ActionResult Edit(Doctor doctor) { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); try { if (ModelState.IsValid) { ctx.Entry(doctor).State = EntityState.Modified; ctx.SaveChanges(); } else { return(Edit(doctor.Id)); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Error editing a doctor: " + e.GetBaseException().ToString()); } return(RedirectToAction("Index")); }
public ActionResult Create(Doctor doctor) { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); try { if (ModelState.IsValid) { ctx.Doctors.Add(doctor); ctx.SaveChanges(); } else { return(Create()); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Error creating a doctor: " + e.GetBaseException().ToString()); } return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); return(ViewFromId(id)); }
public ActionResult Create() { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); return(View()); }
public ActionResult Delete(int id) { Consts.CheckIfLoggedIn(System.Web.HttpContext.Current); return(View(PatientFromId(id))); }