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));
 }
Exemplo n.º 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));
 }
 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }
 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }