Exemplo n.º 1
0
 public ActionResult Create(Department department)
 {
     if (ModelState.IsValid) {
         departmentRepository.InsertOrUpdate(department);
         departmentRepository.Save();
         return RedirectToAction("Index");
     } else {
         ViewBag.PossibleBusinessDivisions = businessdivisionRepository.All;
         return View(department);
     }
 }
Exemplo n.º 2
0
 public ViewResult Search(Department searchDepartment)
 {
     if(searchDepartment!=null)
     {
                     }
                 return View("Index",departmentRepository.AllIncluding(department => department.BusinessDivision));
 }
Exemplo n.º 3
0
 public ActionResult Create()
 {
     Department department = new Department();
     ViewBag.PossibleBusinessDivisions = businessdivisionRepository.All;
     return View(department);
 }
Exemplo n.º 4
0
 public void InsertOrUpdate(Department department)
 {
     if (department.DepartmentID == default(int)) {
         // New entity
         context.Department.Add(department);
     } else {
         // Existing entity
         context.Entry(department).State = EntityState.Modified;
     }
 }