public ActionResult ApprovalTime(tblApprovalTime model, int?id) { if (id > 0) { db.Entry(model).State = EntityState.Modified; db.SaveChanges(); ModelState.Clear(); TempData["msg"] = "Update Succussfully"; } else { db.tblApprovalTime.Add(model); db.SaveChanges(); ModelState.Clear(); TempData["msg"] = "Category Created Successfully"; } return(RedirectToAction("ApprovalTimeDetails")); }
public ActionResult ApprovalTime(int?id, string E) { if (id > 0 && E == "D") { tblApprovalTime model = db.tblApprovalTime.Find(id); db.Entry(model).State = EntityState.Deleted; db.SaveChanges(); TempData["msg"] = "Deleted Sucessfully!"; return(RedirectToAction("ApprovalTimeDetails")); } else if (id > 0) { tblApprovalTime model = db.tblApprovalTime.Find(id); return(View(model)); } return(View()); }