public ActionResult Edit([Bind(Include = "ProductID,Name,ProductNumber,Color,StandardCost,ListPrice,Size,Weight,CategoryID,ProductModelID,SellStartDate,SellEndDate,DiscontinuedDate,ThumbNailPhoto,ThumbnailPhotoFileName,rowguid,ModifiedDate")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } var categories = from cat in db.ProductCategories where cat.CategoryID > 4 select cat; ViewBag.CategoryID = new SelectList(categories, "CategoryID", "Name", product.CategoryID); ViewBag.ProductModelID = new SelectList(db.ProductModels, "ProductModelID", "Name", product.ProductModelID); return(View(product)); }
public void Update(TEntity entity) { dbSet.Attach(entity); context.Entry(entity).State = EntityState.Modified; }