public ActionResult Create(Category category) { ModelState.Remove("CreatedOn"); ModelState.Remove("ModifiedUserName"); ModelState.Remove("ModifiedOn"); if (ModelState.IsValid) { categorymanager.Insert(category); Cache_Helper.RemoveCategoryCache(); return(RedirectToAction("Index", "Categories")); } return(View(category)); }
public ActionResult Edit(Category category) { ModelState.Remove("CreatedOn"); ModelState.Remove("ModifiedUserName"); ModelState.Remove("ModifiedOn"); if (ModelState.IsValid) { Category cat = categorymanager.Find(x => x.Id == category.Id); cat.Title = category.Title; cat.Description = category.Description; categorymanager.Update(category); Cache_Helper.RemoveCategoryCache(); return(RedirectToAction("Index")); } return(View(category)); }