public ActionResult viewTiming(int?id) { enumerable s = new enumerable(); hospital_managementEntities db = new hospital_managementEntities(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Register_doctor p = db.Register_doctor.Find(id); if (p == null) { return(HttpNotFound()); } else { List <Addtimingviewmodel> list = new List <Addtimingviewmodel>(); foreach (Doctor_timing d in db.Doctor_timing) { if (d.id_doctor == id) { Addtimingviewmodel model = new Addtimingviewmodel(); model.Day = d.Day; model.Doctor_id = d.id_doctor; model.Timing = d.Timing; list.Add(model); } } return(View(list)); } }
public ActionResult Edit_Timing(int?id) { hospital_managementEntities db = new hospital_managementEntities(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } else { Doctor_timing t = db.Doctor_timing.Find(id); if (t == null) { return(HttpNotFound()); } else { Addtimingviewmodel k = new Addtimingviewmodel(); k.Day = t.Day; k.Timing = t.Timing; k.Doctor_id = t.id_doctor; return(View(k)); } } }
public ActionResult Edit_Timing(int id, Addtimingviewmodel k) { hospital_managementEntities db = new hospital_managementEntities(); Doctor_timing t = db.Doctor_timing.Find(id); if (t == null) { return(HttpNotFound()); } else { t.Day = k.Day; t.Timing = k.Timing; db.SaveChanges(); return(RedirectToAction("ViewHistory")); } }
public ActionResult Addtiming(int id, Addtimingviewmodel model) { try { hospital_managementEntities db = new hospital_managementEntities(); Doctor_timing t = new Doctor_timing(); t.id_doctor = id; t.Day = model.Day; t.Timing = model.Timing; db.Doctor_timing.Add(t); db.SaveChanges(); //saving ModelState.Clear(); return(View(new Addtimingviewmodel())); } catch (Exception e) { return(View()); } }