public ActionResult Delete(DoctortypeModel N) { var d = db.tblDoctorTypes.SingleOrDefault(x => x.intTypeId == N.TypeId); db.tblDoctorTypes.Remove(d); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { tblDoctorType D = db.tblDoctorTypes.SingleOrDefault(x => x.intTypeId == id); DoctortypeModel N = new DoctortypeModel() { TypeId = D.intTypeId, Type = D.strType, }; return(View(N)); }
public ActionResult Create(DoctortypeModel D) { tblDoctorType dt = new tblDoctorType(); dt.intTypeId = D.TypeId; dt.strType = D.Type; db.tblDoctorTypes.Add(dt); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Index() { var dblist = db.tblDoctorTypes.ToList(); List <DoctortypeModel> list = new List <DoctortypeModel>(); foreach (tblDoctorType D in dblist) { DoctortypeModel dt = new DoctortypeModel(); dt.TypeId = D.intTypeId; dt.Type = D.strType; list.Add(dt); } return(View(list)); }
public ActionResult Edit(DoctortypeModel dt) { tblDoctorType d = db.tblDoctorTypes.SingleOrDefault(x => x.intTypeId == dt.TypeId); if (d != null) { d.intTypeId = dt.TypeId; d.strType = dt.Type; db.SaveChanges(); } return(RedirectToAction("Index")); }