public ActionResult DischargedPatient(MedicalCard medcard) { medcard = medcard.FindMedicalCardByUserID(); Patient patient = new Patient() { UserId = medcard.UserId, MedicalCardID = medcard.CardId.ToString() }; patient = patient.FindPatientById(); patient.MedicalCard = medcard; ViewBag.Medcard = medcard; return(View(patient)); }
public ActionResult PatienMedicalCard(Patient patient) //return View with patien medical card { ApplicationUser user = new ApplicationUser(); MedicalCard medical = new MedicalCard() { UserId = patient.UserId }; user.Id = patient.UserId; patient.User = user.FindUserById(); ViewBag.User = patient.User; ViewBag.error = "To discharge a patient you need to make a diagnosis"; return(View(medical.FindMedicalCardByUserID())); }
public static List <Patient> Patients() { List <Patient> patientList = new List <Patient>(); MedicalCard medical = new MedicalCard(); using (ApplicationDbContext db = new ApplicationDbContext()) { //select only working doctors var WorkPatientList = db.Patients.Where(y => db.Users.Any(x => x.Id == y.UserId && x.Status != "discharged")).ToList(); patientList = WorkPatientList; foreach (var i in db.Users) { foreach (var patient in patientList) { if (i.Id == patient.UserId) { medical.UserId = patient.UserId; patient.User = i; //assign to the doctor his user data patient.MedicalCard = medical.FindMedicalCardByUserID(); //difine user medical card } } } } return(patientList); }