} //End ActionResult Edit //Editin palautus-metodi, alkuperäisen public ActionResult Edit([Bind(Include = "OrderID,CustomerID,EmployeeID,OrderDate,RequiredDate,ShippedDate,ShipVia,Freight,ShipName,ShipAddress,ShipCity,ShipRegion,ShipPostalCode,ShipCountry")] Orders orders) { if (ModelState.IsValid) { db.Entry(orders).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "CompanyName", orders.CustomerID); ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeID", "LastName", orders.EmployeeID); ViewBag.ShipVia = new SelectList(db.Shippers, "ShipperID", "CompanyName", orders.ShipVia); return(View(orders)); } //End ActionResult Edit Bind
public ActionResult Edit([Bind(Include = "CustomerID,CompanyName,ContactName,ContactTitle,Address,City,Region,PostalCode,Country,Phone,Fax")] Customers customers) { if (ModelState.IsValid) { db.Entry(customers).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customers)); }
public ActionResult Edit([Bind(Include = "CategoryID,CategoryName,Description,Picture")] Categories categories) { if (ModelState.IsValid) { db.Entry(categories).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categories)); }
public ActionResult Edit([Bind(Include = "ContactID,ContactType,CompanyName,ContactName,ContactTitle,Address,City,Region,PostalCode,Country,Phone,Extension,Fax,HomePage,PhotoPath,Photo")] Contacts contacts) { if (ModelState.IsValid) { db.Entry(contacts).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(contacts)); }
public ActionResult Edit([Bind(Include = "EmployeeID,LastName,FirstName,Title,TitleOfCourtesy,BirthDate,HireDate,Address,City,Region,PostalCode,Country,HomePhone,Extension,Photo,Notes,ReportsTo,PhotoPath")] emp_apu emp_apu) { if (ModelState.IsValid) { db.Entry(emp_apu).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(emp_apu)); }
public ActionResult Edit([Bind(Include = "ShipperID,RegionID,CompanyName,Phone")] Shippers shippers) { if (ModelState.IsValid) { db.Entry(shippers).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RegionID = new SelectList(db.Region, "RegionID", "RegionDescription", shippers.RegionID); return(View(shippers)); }
public ActionResult Edit([Bind(Include = "EmployeeID,LastName,FirstName,Title,TitleOfCourtesy,BirthDate,HireDate,Address,City,Region,PostalCode,Country,HomePhone,Extension,ReportsTo")] Employees employees) { if (ModelState.IsValid) { db.Entry(employees).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ReportsTo = new SelectList(db.Employees, "EmployeeID", "LastName", employees.ReportsTo); return(View(employees)); }
public ActionResult Edit([Bind(Include = "ShipperID, CompanyName, Phone, RegionID")] Shippers shipper) //haetaan ShipperID jne kentät...? tämä jäi vähän hämäräksi { if (ModelState.IsValid) { db.Entry(shipper).State = EntityState.Modified; db.SaveChanges(); ViewBag.RegionID = new SelectList(db.Region, "RegionID", "RegionDescription", shipper.RegionID); return(RedirectToAction("Index")); } return(View(shipper)); }
public ActionResult Edit([Bind(Include = "OrderID,ProductID,UnitPrice,Quantity,Discount")] Order_Details order_Details) { if (ModelState.IsValid) { db.Entry(order_Details).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrderID = new SelectList(db.Orders, "OrderID", "CustomerID", order_Details.OrderID); ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", order_Details.ProductID); return(View(order_Details)); }
public ActionResult Edit([Bind(Include = "ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued")] Products.Model.Products products) { if (ModelState.IsValid) { db.Entry(products).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "CategoryName", products.CategoryID); ViewBag.SupplierID = new SelectList(db.Suppliers, "SupplierID", "CompanyName", products.SupplierID); return(View(products)); }
public ActionResult Edit([Bind(Include = "ShipperID, CompanyName, Phone, RegionID")] Shippers shipperi) { if (Session["UserName"] == null) { return(RedirectToAction("login", "home")); } else { if (ModelState.IsValid) { db.Entry(shipperi).State = EntityState.Modified; db.SaveChanges(); ViewBag.RegionID = new SelectList(db.Region, "RegionID", "RegionDescription", shipperi.RegionID); return(RedirectToAction("Index")); } return(View(shipperi)); } }