public ActionResult Delete(int id) { using (DBModel db = new DBModel()) { SupportStat support = db.SupportStats.Where(x => x.SupportStatusId == id).FirstOrDefault <SupportStat>(); db.SupportStats.Remove(support); db.SaveChanges(); return(Json(new { success = true, message = "Deleted Successfuly" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddOrEditSupportStatus(SupportStat support) { using (DBModel db = new DBModel()) { if (support.SupportStatusId == 0) { db.SupportStats.Add(support); db.SaveChanges(); //return Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet); return(View("IndexSupportStatus")); } else { db.Entry(support).State = EntityState.Modified; db.SaveChanges(); //return Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet); return(View("IndexSupportStatus")); } } }