public ActionResult Edit(Subcategory subcategory) { if (ModelState.IsValid) { db.Entry(subcategory).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(subcategory); }
public ActionResult Create(Subcategory subcategory) { if (ModelState.IsValid) { db.Subcategories.Add(subcategory); db.SaveChanges(); return RedirectToAction("Index"); } return View(subcategory); }