Exemple #1
0
        public IActionResult List()
        {
            List <ListTransferVehicleVM> Model = _repo.GetAll().Select(p => new ListTransferVehicleVM
            {
                Id   = p.ID,
                Name = p.Name,
                RegistrationNumber = p.RegistrationNumber,
                Driver             = p.Driver,
                Capacity           = p.Capacity
            }).ToList();

            return(View(Model));
        }
        public IActionResult List(int?pageNumber)
        {
            var pageSize = 4;

            var model = _repo.GetAll().OrderBy(a => a.Name).ToList().Select(p => new ListTransferVehicleVM
            {
                Id   = p.ID,
                Name = p.Name,
                RegistrationNumber = p.RegistrationNumber,
                Driver             = p.Driver,
                Capacity           = p.Capacity
            }).AsQueryable();

            var paginatedModel = PaginatedList <ListTransferVehicleVM> .CreateAsync(model, pageNumber ?? 1, pageSize);


            return(View(paginatedModel));
        }