Пример #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);
     }
 }
Пример #2
0
 public ViewResult Search(Department searchDepartment)
 {
     if(searchDepartment!=null)
     {
                     }
                 return View("Index",departmentRepository.AllIncluding(department => department.BusinessDivision));
 }
Пример #3
0
 public ActionResult Create()
 {
     Department department = new Department();
     ViewBag.PossibleBusinessDivisions = businessdivisionRepository.All;
     return View(department);
 }
Пример #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;
     }
 }