public ActionResult Index() { var patient = _db.Patients.Find(User.UserId); var medicalProfiles = _db.MedicalProfiles.Where(mp => mp.PatientId == User.UserId).ToList(); var medicalProfileTemplates = _db.MedicalProfileTemplates.ToList(); SelectList medicalProfileTemplateList = new SelectList(medicalProfileTemplates, "MedicalProfileTemplateId", "MedicalProfileTemplateName", medicalProfileTemplates.First()); var doctorName = _db.Doctors.ToList(); SelectList doctorNameList = new SelectList(doctorName, "UserId", "FullName", doctorName.First()); ViewBag.doctorNameList = doctorNameList; PatientInformation PatientInformation = new PatientInformation { Patient = patient, MedicalProfiles = medicalProfiles }; ViewBag.medicalProfileTemplateList = medicalProfileTemplateList; return PartialView("Index", PatientInformation); }
public ActionResult View(int id = 0, string email = "") { Patient patient; if (id == 0) { patient = _db.Patients.Where(x=>x.Email.Equals(email)).SingleOrDefault(); id = patient.UserId; } else { patient = _db.Patients.Find(id); } var personalHealthRecord = _db.PersonalHealthRecords.Find(id); var medicalProfiles = _db.MedicalProfiles.Where(mp => mp.PatientId == id).ToList(); var medicalProfileTemplates = _db.MedicalProfileTemplates.ToList(); SelectList medicalProfileTemplateList = new SelectList(medicalProfileTemplates, "MedicalProfileTemplateId", "MedicalProfileTemplateName", medicalProfileTemplates.First()); PatientInformation PatientInformation = new PatientInformation { Patient = patient, PersonalHealthRecord = personalHealthRecord, MedicalProfiles = medicalProfiles }; ViewBag.medicalProfileTemplateList = medicalProfileTemplateList; return PartialView("_View", PatientInformation); }
public ActionResult EditPatient(int id = 0) { var patient = _db.Patients.Find(id); var personalHealthRecord = _db.PersonalHealthRecords.Find(id); PatientInformation PatientInformation = new PatientInformation { Patient = patient, PersonalHealthRecord = personalHealthRecord, }; return PartialView("EditPatient", PatientInformation); }