public vmInstructor() { Person = new vmPerson(); Department = new vmDepartment(); Departments = new List <Department>(); Textbook = new vmTextbook(); Textbooks = new List <Textbook>(); InstructorTextbooks = new List <vmTextbook>(); }
public vmInstructor() { Person = new vmPerson(); Department = new vmDepartment(); Departments = new List<Department>(); Textbook = new vmTextbook(); Textbooks = new List<Textbook>(); InstructorTextbooks = new List<vmTextbook>(); }
public ActionResult Edit(int id) { using (DeptManager) { var disp = Mapper.Map<vmDepartment>(DeptManager.GetDepartmentbyID(id)); if (disp == null) { disp = new vmDepartment(); ModelState.AddModelError("", "Failed to load details for requested object"); } return View(disp); } }
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); }
public ActionResult Create(vmDepartment dept) { try { if (ModelState.IsValid) { using (DeptManager) { var item = Mapper.Map<Department>(dept); var success = DeptManager.AddDepartment(item); if (success) { return RedirectToAction("Index"); } throw new DataException("Failed to save " + dept.Name + " Department. Please try again."); } } } catch (DataException ex) { ModelState.AddModelError("", ex.Message); } return View(dept); }
public ActionResult Create() { var disp = new vmDepartment(); return View(disp); }