// if the patient id is not exist return first patient public PatientMiniData getPatinetMiniInfo(int patientID) { PatientMiniData patientMini = null; using (Entities.Entities ctx = new Entities.Entities()) { Patient patient = ctx.Patients.Find(patientID); if (patient == null) { patient = ctx.Patients.FirstOrDefault(); } if (patient != null) { patientMini = new PatientMiniData { PatientID = patient.PatientID, Name = patient.Name, Phone = patient.Phone, Mobile = patient.Mobile, Address = patient.Address } } ; //var patientIQ = ctx.Patients; //patient = (from p in patientIQ // where p.PatientID == patientID // select new PatientMiniData { PatientID = p.PatientID, Name = p.Name, Mobile = p.Mobile, Phone = p.Phone, Address = p.Address }).; } return(patientMini); }
// /DoctorDashboard/PatientSearch/ActivePatientTopBar public ActionResult ActivePatientTopBar() { int patientID = getCurrentPatientID(); if (patientID == 0) { return(PartialView("NoActivePatientView")); } PatientMiniData patient = patientRepository.getPatinetMiniInfo(patientID); if (patient == null) { return(PartialView("NoActivePatientView")); } return(PartialView(patient)); }