public ActionResult Create(Category category) { if (ModelState.IsValid) { context.Categories.Add(category); context.SaveChanges(); return RedirectToAction("Index"); } return View(category); }
public ActionResult Edit(Category category) { if (ModelState.IsValid) { context.Entry(category).State = EntityState.Modified; context.SaveChanges(); return RedirectToAction("Index"); } return View(category); }