예제 #1
0
 public ActionResult AddOrEdit(int id = 0)
 {
     if (id == 0)
     {
         ViewBag.Employees   = new SelectList(_employeeAppService.GetEmployeeList().Take(10), "EmployeeCode", "EmployeeName");
         ViewBag.Departments = new SelectList(_employeeAppService.GetDepartmentList().Take(10), "DeptCode1", "DeptName1");
         return(View(new Team.Team()));
     }
     else
     {
         var team = _teamAppService.GetTeamList().Where(x => x.Id == id).FirstOrDefault();
         ViewBag.Employees   = new SelectList(_employeeAppService.GetEmployeeList().Where(x => x.EmployeeCode == team.TeamLeader).ToList(), "EmployeeCode", "EmployeeName");
         ViewBag.Departments = new SelectList(_employeeAppService.GetDepartmentList().Where(x => x.DeptCode1 == team.DepartmentID).ToList(), "DeptCode1", "DeptName1");
         return(View(team));
     }
 }
예제 #2
0
        public ActionResult GetDepartmentList(string searchTerm, int pageSize, int pageNum)
        {
            int totalCount = 0;
            var itemList   = _employeeAppService.GetDepartmentList(searchTerm, pageSize, pageNum, out totalCount);
            var result     = new
            {
                Total   = totalCount,
                Results = itemList
            };

            return(new JsonResult
            {
                Data = result,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }