public ViewResult List(string status, int page = 1) { EmployeesListViewModel model = new EmployeesListViewModel { Employees = repository.Employees .Where(p => status == null || p.Status == status) .OrderBy(p => p.EmployeeId) .Skip((page - 1) * PageSize) .Take(PageSize), PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = PageSize, TotalItems = status == null ? repository.Employees.Count() : repository.Employees.Where(e => e.Status == status).Count() }, CurrentStatus = status }; return View(model); }
public ViewResult Index(string position, int page = 1) { EmployeesListViewModel model = new EmployeesListViewModel { Employees = repository.Employees .Where(p => position == null || p.Position == position) .OrderBy(p => p.EmployeeId) .Skip((page - 1) * PageSize) .Take(PageSize), PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = PageSize, TotalItems = position == null ? repository.Employees.Count() : repository.Employees.Where(e => e.Position == position).Count() }, CurrentPosition = position }; return View(model); }