public ActionResult DeleteConfirmed(int id) { Category category = categoryManager.Find(x => x.ID == id); categoryManager.Delete(category); CacheHelpers.ClearCache("categories-cache"); return(RedirectToAction("Index")); }
public ActionResult Create(Category category) { ModelState.Remove("Password"); ModelState.Remove("CreatedOn"); ModelState.Remove("ModifiedOn"); ModelState.Remove("ModifiedUserName"); if (ModelState.IsValid) { categoryManager.insert(category); CacheHelpers.ClearCache("categories-cache"); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit(Category category) { ModelState.Remove("Password"); ModelState.Remove("CreatedOn"); ModelState.Remove("ModifiedOn"); ModelState.Remove("ModifiedUserName"); if (ModelState.IsValid) { Category res = categoryManager.Find(x => x.ID == category.ID); if (res != null) { res.Title = category.Title; res.Description = category.Description; categoryManager.Update(res); CacheHelpers.ClearCache("categories-cache"); return(RedirectToAction("Index")); } } return(View(category)); }