public ActionResult AddPatient([Bind(Include = "FirstName,LastName,Email,ContactNo")] PatientVM pvm) { PatientsBL pbl = new PatientsBL(context); DoctorsBL dbl = new DoctorsBL(context); if (!ModelState.IsValid) { ViewBag.error = true; return(PartialView("~/Areas/Doctors/Views/Partials/AddPatientPartial.cshtml", pvm)); } else { //Patient newPatient = pvm.mapPatientDataFromVM(); Patient p = new Patient(); p.Email = pvm.Email; p.PatientSince = DateTime.Now; p.FirstName = pvm.FirstName; p.LastName = pvm.LastName; p.Contact = pvm.ContactNo; p.Doctor = dbl.getByUN(User.Identity.Name); p.Supervisor = dbl.getByUN(User.Identity.Name).DocID; pbl.insertPatient(p); ViewBag.dataSaved = true; return(PartialView("~/Areas/Doctors/Views/Partials/AddPatientPartial.cshtml", pvm)); } }
// GET: Doctors/Profile public ActionResult Index() { DoctorsBL dbl = new DoctorsBL(context); Doctor loggedInDoc = dbl.getByUN(User.Identity.Name); ViewBag.doctor = loggedInDoc; DocProfileVM profVM = dbl.docProfVMfromDoc(loggedInDoc); ViewBag.profile = profVM; return(View("ProfileView")); }
// GET: Doctors/PatientView public ActionResult Index(String searchString) { DoctorsBL dbl = new DoctorsBL(context); PatientsBL pbl = new PatientsBL(context); Doctor LoggedInDoc = dbl.getByUN(User.Identity.Name); //sorting desc by PatientSince Value List <Patient> patientsOfThisDoc = pbl.getPatientList(LoggedInDoc.DocID).OrderByDescending(o => o.PatientSince).OrderBy(o => o.FirstName).ToList(); ViewBag.Stag = searchString; if (!String.IsNullOrEmpty(searchString)) { patientsOfThisDoc = patientsOfThisDoc.Where(o => o.FirstName.ToLower().Contains(searchString.ToLower()) || o.LastName.ToLower().Contains(searchString.ToLower()) || o.Contact.ToLower().Contains(searchString.ToLower()) || o.Email.Contains(searchString.ToLower())).ToList(); } return(View("PatientList", patientsOfThisDoc)); }