public ActionResult Delete(int id) { Models.Dept d = obj.Depts.Find(id); obj.Depts.Remove(d); obj.SaveChanges(); return(RedirectToAction("Index", "Dept")); }
public ActionResult Edit(int Id) { TempData.Keep(); Models.Dept d = obj.Depts.Find(Id); obj.SaveChanges(); return(View("Index", d)); }
public ActionResult Index(Models.Dept e1, string b1) { if (b1 == "Save") { obj.Depts.Add(e1); obj.SaveChanges(); } else if (b1 == "Update") { Dept d = obj.Depts.Find(e1.Dno); d.Dname = e1.Dname; obj.SaveChanges(); } return(RedirectToAction("Index")); }