public ActionResult Edit([Bind(Include = "CategoryID,CategoryName")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit( [Bind(Include = "ProductID,EAN,Title,productName,productDescription,CategoryID,validFrom")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "CategoryName", product.CategoryID); return(View(product)); }