예제 #1
0
 public ActionResult Edit(Product subject)
 {
     if (ModelState.IsValid)
     {
         db.Entry(subject).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(subject));
 }
예제 #2
0
 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));
 }
예제 #3
0
 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));
 }