public ActionResult Addprescription(Addprescriptionviewmodel model) { hospital_managementEntities db = new hospital_managementEntities(); Register_patient R = db.Register_patient.Find(model.PatientId); if (R == null) { return(HttpNotFound()); } else { Patient_Prescription p = new Patient_Prescription(); p.Duration = model.Duration; p.Evening = model.Evening; p.Medicine = model.Medicine; p.Morning = model.Morning; p.Noon = model.Noon; p.Registerid = model.PatientId; db.Patient_Prescription.Add(p); db.SaveChanges(); return(RedirectToAction("AddHistory")); } }
public ActionResult Edit(int id, Addprescriptionviewmodel collection) { try { // TODO: Add update logic here hospital_managementEntities db = new hospital_managementEntities(); Patient_Prescription p = db.Patient_Prescription.Find(id); if (p == null) { return(HttpNotFound()); } else { p.Duration = collection.Duration; p.Evening = collection.Evening; p.Medicine = collection.Medicine; p.Morning = collection.Morning; p.Noon = collection.Noon; p.Registerid = collection.PatientId; db.SaveChanges(); } return(RedirectToAction("checkdetails")); } catch (Exception e) { 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 })); } }
public ActionResult Delete(int id, FormCollection collection) { hospital_managementEntities db = new hospital_managementEntities(); try { // TODO: Add delete logic here Patient_Prescription r = db.Patient_Prescription.Find(id); db.Patient_Prescription.Remove(r); db.SaveChanges(); return(RedirectToAction("checkdetails")); } catch (Exception e) { return(View()); } }
// GET: Doctor/Delete/5 public ActionResult Delete(int id) { hospital_managementEntities db = new hospital_managementEntities(); Patient_Prescription r = db.Patient_Prescription.Find(id); if (r == null) { return(HttpNotFound()); } else { Addprescriptionviewmodel p = new Addprescriptionviewmodel(); p.Duration = r.Duration; p.Evening = r.Evening; p.Medicine = r.Medicine; p.Morning = r.Morning; p.Noon = r.Noon; p.PatientId = id; return(View(p)); } }
// GET: Doctor/Edit/5 public ActionResult Edit(int id) { hospital_managementEntities db = new hospital_managementEntities(); Patient_Prescription p = db.Patient_Prescription.Find(id); if (p == null) { return(HttpNotFound()); } else { Addprescriptionviewmodel model = new Addprescriptionviewmodel(); model.Duration = p.Duration; model.Evening = p.Evening; model.Medicine = p.Medicine; model.Morning = p.Morning; model.Noon = p.Noon; model.PatientId = id; ViewBag.collection = model; return(View(model)); } }