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