Beispiel #1
0
 public ActionResult Edit([Bind(Include = "EmployeeID,FirstName,LastName,HireDate")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employee));
 }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "ProductID,ProductName,UPC,Price,Inventory")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(product));
 }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "CustomerID,FirstName,LastName,PurchaseDate")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "DepartmentID,DepartmentName")] Department department)
 {
     if (ModelState.IsValid)
     {
         db.Entry(department).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(department));
 }
Beispiel #5
0
 public ActionResult Edit([Bind(Include = "PurchaseID,CustomerID,ProductID")] Purchase purchase)
 {
     if (ModelState.IsValid)
     {
         db.Entry(purchase).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "FirstName", purchase.CustomerID);
     ViewBag.ProductID  = new SelectList(db.Products, "ProductID", "ProductName", purchase.ProductID);
     return(View(purchase));
 }
Beispiel #6
0
 public ActionResult Edit([Bind(Include = "AssignmentID,DepartmentID,EmployeeID")] Assignment assignment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assignment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "DepartmentName", assignment.DepartmentID);
     ViewBag.EmployeeID   = new SelectList(db.Employees, "EmployeeID", "FirstName", assignment.EmployeeID);
     return(View(assignment));
 }