Exemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "Id,Name,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 = "Id,CompanyName,ContactName,ContactTitle,MyProperty,City,Region,PostalCode,Country,Phone,Fax,HomePage")] Supplier supplier)
 {
     if (ModelState.IsValid)
     {
         db.Entry(supplier).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(supplier));
 }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,CompanyName,Phone")] Shipper shipper)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shipper).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(shipper));
 }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "Id,CompanyName,ContactName,ContactTitle,Address,City,Region,PostalCode,Country,Phone,Fax")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
Exemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "Id,CustomerId,OrderDate,RequiredDate,ShippedDate,ShipVia,Freight,ShipName,ShipAddress,ShipCity,ShipRegion,ShipPostalCode,ShipCountry")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerId = new SelectList(db.Customers, "Id", "CompanyName", order.CustomerId);
     return(View(order));
 }
Exemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "Id,OrderId,ProductId,UnitPrice,Quantity,Discount")] OrderDetail orderDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orderDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OrderId   = new SelectList(db.Orders, "Id", "ShipName", orderDetail.OrderId);
     ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", orderDetail.ProductId);
     return(View(orderDetail));
 }
Exemplo n.º 7
0
 public ActionResult Edit([Bind(Include = "Id,SectionId,SizeId")] SectionSize sectionSize)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sectionSize).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SectionId = new SelectList(db.Sections, "Id", "Name", sectionSize.SectionId);
     ViewBag.SizeId    = new SelectList(db.Sizes, "Id", "Name", sectionSize.SizeId);
     return(View(sectionSize));
 }
Exemplo n.º 8
0
 public ActionResult Edit([Bind(Include = "Id,Name,SupplierId,CategoryId,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", product.CategoryId);
     ViewBag.SupplierId = new SelectList(db.Suppliers, "Id", "CompanyName", product.SupplierId);
     return(View(product));
 }