public ActionResult Edit([Bind(Include = "ID,Name,Email")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
예제 #2
0
 public ActionResult Edit([Bind(Include = "ID,Manufacturer,Model,EnginePower")] Car car)
 {
     if (ModelState.IsValid)
     {
         db.Entry(car).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(car));
 }
예제 #3
0
 public ActionResult Edit([Bind(Include = "ID,CarID,CustomerID,SalePrice,PurchasedOn")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CarID      = new SelectList(db.Cars, "ID", "Manufacturer", order.CarID);
     ViewBag.CustomerID = new SelectList(db.Customers, "ID", "Name", order.CustomerID);
     return(View(order));
 }