public Product GetProduct(int Id) { var product = _commerceDbContext.Product.Find(Id); _commerceDbContext.Entry(product).Reference(p => p.Category).Load(); _commerceDbContext.Entry(product).Collection(p => p.ProductImages).Load(); return(product); }
public ActionResult Edit([Bind(Include = "ProductID,Name,Price")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }