Example #1
0
 public ActionResult Edit(vmDepartment dept)
 {
     try
     {
         using (DeptManager)
         {
             var item = DeptManager.GetDepartmentbyID(dept.ID);
             item.Name = dept.Name;
             var success = DeptManager.UpdateDepartment(item);
             if (success)
             {
                 return(RedirectToAction("Index"));
             }
             throw new DataException("Failed to save " + dept.Name + ". Please try again");
         }
     }
     catch (DataException ex)
     {
         ModelState.AddModelError("", ex.Message);
     }
     return(View(dept));
 }