public ActionResult Edit([Bind(Include = "ProductName,Description,IsPublished,Quantity,Price,ImageFile,DateCreated,CreatedBy,DateModified,ModifiedBy")] Store.Data.Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public void UpdateProducer(int id, string name) { db = new MyDataEntities(); var producer = db.Producers.Find(id); producer.Name = name; db.Entry(producer).State = System.Data.EntityState.Modified; db.SaveChanges(); }
public void UpdateCart(int id, int quantity, int total) { db = new MyDataEntities(); var cart = db.Carts.Find(id); cart.Quantity = quantity; cart.Total = total; db.Entry(cart).State = System.Data.EntityState.Modified; db.SaveChanges(); }
public void UpdateItem(int id, string name, int producer, int quantity, int price) { db = new MyDataEntities(); var item = db.Items.Find(id); item.Name = name; item.Producer = producer; item.Amount = quantity; item.Price = price; db.Entry(item).State = System.Data.EntityState.Modified; db.SaveChanges(); }