// 1. *************RETRIEVE ALLDoctor DETAILS ****************** // GET:Doctor public ActionResult DoctorList() { DoctorMasterDbHandle dbhandle = new DoctorMasterDbHandle(); ModelState.Clear(); return(View(dbhandle.GetDoctor())); }
public ActionResult Edit(int id, DoctorClass smodel) { try { DoctorMasterDbHandle sdb = new DoctorMasterDbHandle(); sdb.UpdateDetails(smodel); return(RedirectToAction("DoctorList")); } catch (Exception ex) { Console.WriteLine(ex); return(View()); } }
// 4. ************* DELETEDoctor DETAILS ****************** // GET:Doctor/Delete/5 public ActionResult Delete(int id) { try { DoctorMasterDbHandle sdb = new DoctorMasterDbHandle(); if (sdb.DeleteDoctor(id)) { ViewBag.AlertMsg = "S Deleted Successfully"; } return(RedirectToAction("DoctorList")); } catch { return(View()); } }
public ActionResult Create(DoctorClass smodel) { try { if (ModelState.IsValid) { DoctorMasterDbHandle sdb = new DoctorMasterDbHandle(); if (sdb.AddDoctor(smodel)) { ViewBag.Message = "Doctor Details Added Successfully"; ModelState.Clear(); } } return(View()); } catch (Exception ex) { ex.StackTrace.ToString(); return(View()); } }
// 3. ************* EDITDoctor DETAILS ****************** // GET:Doctor/Edit/5 public ActionResult Edit(int id) { DoctorMasterDbHandle sdb = new DoctorMasterDbHandle(); return(View(sdb.GetDoctor().Find(smodel => smodel.DoctorId == id))); }