public ActionResult Edit_history(int id) { hospital_managementEntities db = new hospital_managementEntities(); Patient_History p = db.Patient_History.Find(id); if (p == null) { return(HttpNotFound()); } else { Addhistoryviewmodel model = new Addhistoryviewmodel(); model.Age = p.Age; model.BP = p.BP; model.Gender = p.Gender; model.id = p.id; model.indications = p.indications; model.PatientId = p.patient_id; model.Pulse = p.Pulse; model.Weight = p.Weight; ViewBag.collection = model; return(View(model)); } }
public ActionResult Edit_history(int id, Addhistoryviewmodel collection) { try { // TODO: Add update logic here hospital_managementEntities db = new hospital_managementEntities(); Patient_History p = db.Patient_History.Find(id); if (p == null) { return(HttpNotFound()); } else { p.Age = collection.Age; p.BP = collection.BP; p.Gender = collection.Gender; p.indications = collection.indications; p.patient_id = collection.PatientId; p.Pulse = collection.Pulse; p.Weight = collection.Weight; db.SaveChanges(); } return(RedirectToAction("checkdetails")); } catch (Exception e) { return(View()); } }
public ActionResult AddHistory(Addhistoryviewmodel model) { hospital_managementEntities db = new hospital_managementEntities(); Register_patient S = db.Register_patient.Find(model.PatientId); if (S == null) { return(HttpNotFound()); } else { Patient_History h = new Patient_History(); h.Gender = model.Gender; h.Age = model.Age; h.Weight = model.Weight; h.BP = model.BP; h.Pulse = model.Pulse; h.patient_id = model.PatientId; h.indications = model.indications; db.Patient_History.Add(h); db.SaveChanges(); return(RedirectToAction("checkdetails")); } return(View()); }
public ActionResult checkdetails(checkdetailsviewmodel mod) { int r = 0; int k = 0; list_pat_details list = new list_pat_details(); hospital_managementEntities db = new hospital_managementEntities(); Patient_Prescription R = db.Patient_Prescription.Find(mod.PatientId); Patient_History K = db.Patient_History.Find(mod.PatientId); foreach (Patient_Prescription p in db.Patient_Prescription) { if (p.Registerid == mod.PatientId) { r = 1; } } foreach (Patient_History p in db.Patient_History) { if (p.patient_id == mod.PatientId) { k = 1; } } if (r == 0 && k == 0) { return(HttpNotFound()); } /*else * { * * Addprescriptionviewmodel S = new Addprescriptionviewmodel(); * Addhistoryviewmodel Q = new Addhistoryviewmodel(); * * * S.PatientId = mod.PatientId; * S.Medicine = R.Medicine; * S.Duration = R.Duration; * S.Morning = R.Noon; * S.Evening = R.Evening; * S.Morning = R.Morning; * Q.Gender = K.Gender; * Q.Age = K.Age; * Q.BP = K.BP; * Q.Weight = K.Weight; * Q.Pulse = K.Pulse; * Q.indications = K.indications; * Q.PatientId = mod.PatientId; * list.list_history.Add(Q); * * list.list_prescription.Add(S); * * }*/ else { return(RedirectToAction("checkdetailslist", new { id = mod.PatientId })); } }
private async void Submit_OnClick(object sender, EventArgs e) { if (isMedical == true && isDanger == false) { if (TextEntry.Text == null || YearEntry.Text == null || typePicker.SelectedItem == null) { await DisplayAlert("Alert", "All the fields must be filled in.", "OK"); } else { var todo = new Patient_History { Type = selectedMedical, Year = YearEntry.Text, Text = TextEntry.Text, PatientID_FK = currentUserId, History_id = historyID.ToString() }; await AddMedicalItem(todo); } historyID++; //unassign values typePicker.SelectedIndex = 0; TextEntry.Text = String.Empty; YearEntry.Text = String.Empty; EditButton2.IsVisible = true; fields.IsVisible = false; MainContentView.IsVisible = true; MedHist_Clicked(sender, e); } if (isMedical == false && isDanger == true) { if (DangerEntry.Text == null) { await DisplayAlert("Alert", "All the fields must be filled in.", "OK"); } else { var todo = new DangerActual_Table { PatientID_FK = currentUserId, Text = DangerEntry.Text }; await AddActualDangerItem(todo); } DangerEntry.Text = String.Empty; fields.IsVisible = false; MainContentView.IsVisible = true; Dangers_Clicked(sender, e); } }
public ActionResult Delete_history(int id, FormCollection collection) { hospital_managementEntities db = new hospital_managementEntities(); try { // TODO: Add delete logic here Patient_History r = db.Patient_History.Find(id); db.Patient_History.Remove(r); db.SaveChanges(); return(RedirectToAction("checkdetails")); } catch (Exception e) { return(View()); } }
async Task AddMedicalItem(Patient_History item) { await manager.SaveTaskAsyncPatientMedical(item); }