public ActionResult Add(Diagnose diagnose, Diagnoserecord history, int ID) { if (Session["user"] != null) { var user = Session["user"].ToString(); var doctor = _db.Doctors.Where(x => x.Username == user).FirstOrDefault(); int DocId = doctor.Vetid; string Docname = doctor.Fullname; diagnose.DocName = Docname; diagnose.Vetid = DocId; diagnose.Datetoday = DateTime.Now; TempData["diagnosemsg"] = "text"; TempData["msg"] = "hey"; _db.Diagnoses.Add(diagnose); _db.SaveChanges(); //Diagnose History// history.DocName = Docname; history.Vetid = DocId; history.Datetoday = DateTime.Now; _db.Diagnoserecords.Add(history); _db.SaveChanges(); var patient = _db.Patients.Find(ID); if (patient != null) { _db.Patients.Remove(patient); _db.SaveChanges(); } return(RedirectToAction("index", "Diagnose")); } return(RedirectToAction("Logoff", "Account")); }
public ActionResult Add(Diagnoserecord history) { return(View()); }