public virtual void Delete(TEntity entityToDelete) { if (context.Entry(entityToDelete).State == EntityState.Detached) { dbSet.Attach(entityToDelete); } dbSet.Remove(entityToDelete); }
public ActionResult Edit([Bind(Include = "ProductID,ProductName,ProductDescription,ProdCategoryID,Price,Vendor,QuantityInStock,ProductImage")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.prodCategoryID = new SelectList(db.ProductCategories, "ProdCategoryID", "CategoryName", product.ProdCategoryID); return(View(product)); }