public ActionResult StartReception(int?recordId) { Record record = db.Records.Find(recordId); ApplicationUser patient = db.Users.Find(record.PatientId); ViewBag.Patient = patient; PatientInform patientInform = db.PatientInforms.Find(patient.PatientInformId); ViewBag.PatientInfo = patientInform; var medicalCard = db.Records.Where(u => u.PatientId == record.PatientId && record.EndDate < DateTime.Now).ToList(); ViewBag.MedicalCard = medicalCard; return(View()); }
public ActionResult EditGeneralInfoPatient(PatientInform patientInform) { if (ModelState.IsValid) { ApplicationUser user = db.Users.Find(User.Identity.GetUserId()); PatientInform newPatient = db.PatientInforms.Find(user.PatientInform.Id); newPatient.Activity = patientInform.Activity; newPatient.Adress = patientInform.Adress; newPatient.Allergy = patientInform.Allergy; newPatient.BloodGroup = patientInform.BloodGroup; newPatient.Diabetes = patientInform.Diabetes; newPatient.Infectious_diseases = patientInform.Infectious_diseases; newPatient.Operations = patientInform.Operations; db.SaveChanges(); return(RedirectToAction("MyAccount")); } return(View(patientInform)); }
public ActionResult RegisterPatient(RegisterPatientModel model) { if (ModelState.IsValid) { ApplicationUser user = db.Users.Find(User.Identity.GetUserId());; PatientInform patientInform = new PatientInform { Allergy = model.Allergy, BloodGroup = model.BloodGroup, Diabetes = model.Diabetes, Activity = model.Activity, Adress = model.Adress, Infectious_diseases = model.Infectious_diseases, Operations = model.Operations }; db.PatientInforms.Add(patientInform); db.SaveChanges(); user.PatientInformId = patientInform.Id; user.Name = model.Name; user.Gender = model.Gender; user.Bithday = model.Birthday; db.SaveChanges(); return(RedirectToAction("MyAccount")); } return(View(model)); }