public ActionResult Edit(Product subject) { if (ModelState.IsValid) { db.Entry(subject).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(subject)); }
public ActionResult Edit([Bind(Include = "Id,CustomerId,TotalPrice")] Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(db.Customers, "Id", "Name", order.CustomerId); return(View(order)); }
public ActionResult Edit([Bind(Include = "Id,ProductId,Quantity,OrderId")] OrderDetail orderDetail) { if (ModelState.IsValid) { db.Entry(orderDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrderId = new SelectList(db.Orders, "Id", "Id", orderDetail.OrderId); ViewBag.ProductId = new SelectList(db.Products, "Id", "Title", orderDetail.ProductId); return(View(orderDetail)); }