コード例 #1
0
 public ActionResult Edit([Bind(Include = "TradeID,Name")] Trade trade)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trade).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(trade));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "CustomerID,Name,Address,PhoneNumbers,Usernames,Password,HashPassword,AccessManagement")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "ProductID,Name,Origin,Price,Description,Quantity,ProductTypeID,TradeID,Images1,Images2,Images3,Images4")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductTypeID = new SelectList(db.ProductTypes, "ProductTypeID", "Name", product.ProductTypeID);
     ViewBag.TradeID       = new SelectList(db.Trades, "TradeID", "Name", product.TradeID);
     return(View(product));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "CartID,CustomerID,DateCreate,ProductID,Quantity,Status,TotalMoney")] Cart cart)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cart).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "Name", cart.CustomerID);
     ViewBag.ProductID  = new SelectList(db.Products, "ProductID", "Name", cart.ProductID);
     return(View(cart));
 }