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