public ViewResult Index() { var result = new List <EmployeeModel>(); var employees = _employeeService.GetAll(); return(View(employees.Select(x => _mapperFactory.MappEmployeeToEmployeeModel <EmployeeModel>(x)).ToList())); }
public ViewResult List(string category, int managerId, int page = 1) { List <EmployeeModel> employeeModels = null; if (managerId == 0) { employeeModels = _employeeService.GetAll().Select(x => _mapperFactory.MappEmployeeToEmployeeModel <EmployeeModel>(x)).ToList(); } else { employeeModels = GetTreeEmployeeList(managerId); } TempData["ManagerId"] = managerId; EmployeeListModel model = new EmployeeListModel { ManagerId = managerId, Employees = employeeModels .Where(x => category == null || x.DepartmentName == category) .OrderBy(x => x.FirstName) .Skip((page - 1) * PageSize) .Take(PageSize), PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = PageSize, TotalItems = category == null?employeeModels.Count() : employeeModels.Where(e => e.DepartmentName == category).Count() }, CurrentCategory = category }; return(View(model)); }