コード例 #1
0
 public ActionResult Edit([Bind(Include = "AssetID,AssetLocation,AssetName,AssetType,AssetStock,AssetPrice")] Asset asset)
 {
     if (ModelState.IsValid)
     {
         db.Entry(asset).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(asset));
 }
コード例 #2
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));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "EmployeeID,EmployeeTitle,EmployeeFirstName,EmployeeLastName,EmployeeAddress,EmployeePhone,EmployeeEmail,DepartmentID")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "DepartmentName", employee.DepartmentID);
     return(View(employee));
 }