public ActionResult AddCategoryForEdit(Category newCategory) { try { context.Categories.Add(newCategory); context.SaveChanges(); return RedirectToAction("EditInfo"); } catch { return View(); } }
public ActionResult DelCategory(int id, Category category) { try { context.Entry(category).State = System.Data.EntityState.Deleted; context.SaveChanges(); return RedirectToAction("CategoryList"); } catch { return View(); } }