コード例 #1
0
 public ActionResult Edit([Bind(Include = "CategoryID,CategoryName,Description")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "CustomerID,Firstname,Lastname,MailAdress,StreetAdress,City,ZipCode,CompanyName,CompanyPhoneNumber,CompanyWebSite")] CorporateCustomer corporateCustomer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(corporateCustomer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(corporateCustomer));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "ShippingCompanyID,ShippingCompanyName,ShippingCost")] ShippingCompany shippingCompany)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shippingCompany).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(shippingCompany));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "CustomerID,Firstname,Lastname,MailAdress,StreetAdress,City,ZipCode,MobileNumber")] PrivateCustomer privateCustomer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(privateCustomer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(privateCustomer));
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "ManufacturerID,ManufacturerName")] Manufacturer manufacturer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(manufacturer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(manufacturer));
 }
コード例 #6
0
 public ActionResult Edit([Bind(Include = "OrderID,ProductID,ProductQuantity")] ProductOrder productOrder)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productOrder).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OrderID   = new SelectList(db.Orders, "OrderID", "OrderID", productOrder.OrderID);//changed second parameter from orderstatus to orderid
     ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", productOrder.ProductID);
     return(View(productOrder));
 }
コード例 #7
0
 public ActionResult Edit([Bind(Include = "OrderID,OrderStatus,ShippingDate,TotalPrice,CustomerID,ShippingCompanyID")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerID        = new SelectList(db.Customers, "CustomerID", "Firstname", order.CustomerID);
     ViewBag.ShippingCompanyID = new SelectList(db.ShippingCompanies, "ShippingCompanyID", "ShippingCompanyName", order.ShippingCompanyID);
     return(View(order));
 }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "ProductID,DiscountPercentage,Stock,UnitPrice,ProductName,CategoryID,ManufacturerID")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryID     = new SelectList(db.Categories, "CategoryID", "CategoryName", product.CategoryID);
     ViewBag.ManufacturerID = new SelectList(db.Manufacturers, "ManufacturerID", "ManufacturerName", product.ManufacturerID);
     return(View(product));
 }