コード例 #1
0
        public IActionResult Index(int?pageNumber)
        {
            var employees = _employeeService.GetAll().Select(e => new EmployeeIndexViewModel()
            {
                Id             = e.Id,
                EmployeeNumber = e.EmployeeNumber,
                FullName       = e.FullName,
                Gender         = e.Gender,
                ImageUrl       = e.ImageUrl,
                DateJoined     = e.DateJoined,
                Designation    = e.Designation,
                City           = e.City
            }).ToList();

            return(View(EmployeeListPagination <EmployeeIndexViewModel> .Create(employees, pageNumber ?? 1, ConstantsKeys.PAGINATION_PAGE_SIZE)));
        }
コード例 #2
0
 // including pagination (pages)
 public IActionResult Index(int? pageNumber)
 {
     var employees = _employeeService.GetAll().Select(employee => new EmployeeIndexViewModel
     {
         Id = employee.Id,
         EmployeeNo = employee.EmployeeNo,
         ImageUrl = employee.ImageUrl,
         FullName = employee.FullName,
         Gender = employee.Gender,
         DateJoined =  employee.DateJoined,
         Designation = employee.Designation, 
         City = employee.City
     }).ToList();
     int pageSize = 4;   
     return View(EmployeeListPagination<EmployeeIndexViewModel>.Create(employees, pageNumber ?? 1, pageSize));
 }
コード例 #3
0
        public async Task <IActionResult> Index(int?pageNumber)
        {
            var employees = await _employeeService.GetAll();

            var employeesToView = employees.OrderBy(emp => emp.FullName).Select(employee => new EmployeeIndexViewModel
            {
                Id          = employee.Id,
                EmployeeNo  = employee.EmployeeNo,
                ImageUrl    = employee.ImageUrl,
                FullName    = employee.FullName,
                Gender      = employee.Gender,
                Designation = employee.Designation,
                City        = employee.City,
                DateJoined  = employee.DateJoined
            }).ToList();
            int pageSize = 4;

            return(View(EmployeeListPagination <EmployeeIndexViewModel> .Create(employeesToView, pageNumber ?? 1, pageSize)));
        }
コード例 #4
0
        public async Task <IActionResult> SearchView(int?pageNumber, string searchid)
        {
            var result = await GetSearchResult(searchid);

            var employees = _employeeService.GetAllSearch(result).Select(employee => new EmployeeIndexViewModel
            {
                Id           = employee.Id,
                AddressId    = employee.AddressId,
                EmployeeNo   = employee.EmployeeNo,
                ImageUrl     = employee.ImageUrl,
                FirstName    = employee.FirstName,
                LastName     = employee.LastName,
                MiddleName   = employee.MiddleName,
                Gender       = employee.Gender,
                DateJoined   = employee.DateJoined,
                Designation  = employee.Designation,
                DepartmentId = employee.DepartmentId
            }).ToList();
            int pageSize = 4;

            return(View(EmployeeListPagination <EmployeeIndexViewModel> .Create(employees, pageNumber ?? 1, pageSize)));
        }
コード例 #5
0
        public IActionResult Index(int?pageNumber)
        {
            var employees = _employeeService.GetAll().Select(employee => new EmployeeIndexViewModel
            {
                Id           = employee.Id,
                AddressId    = employee.AddressId,
                DepartmentId = employee.DepartmentId,
                EmployeeNo   = employee.EmployeeNo,
                ImageUrl     = employee.ImageUrl,
                FirstName    = employee.FirstName,
                LastName     = employee.LastName,
                MiddleName   = employee.MiddleName,
                Gender       = employee.Gender,
                DateJoined   = employee.DateJoined,
                Designation  = employee.Designation,
                department   = _context.Departments.FirstOrDefault(x => x.Id == employee.DepartmentId)
            }).ToList();
            int pageSize = 4;

            ViewBag.List = employees;
            return(View(EmployeeListPagination <EmployeeIndexViewModel> .Create(employees, pageNumber ?? 1, pageSize)));
        }