public OrderPagination GetOrderList(int currentPage = 1, int pageSize = 5)
        {
            try
            {
                OrderPagination model = new OrderPagination();

                var orderList = _orderRepository.GetOrderList(currentPage, pageSize);

                model.OrderList = orderList;
                int totalCount = orderList.Count();
                var page       = new Pagination()
                {
                    Count       = totalCount,
                    CurrentPage = currentPage,
                    PageSize    = pageSize,
                    TotalPages  = (int)Math.Ceiling(decimal.Divide(totalCount, pageSize))
                };

                model.Pagination = page;
                return(model);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Beispiel #2
0
        public async Task <IActionResult> Index(int?PageNumber)
        {
            ApplicationUser usr = await GetCurrentUserAsync();

            var user = await _usermanager.FindByIdAsync(usr.Id);


            var paramter = new DynamicParameters();

            paramter.Add("@managerid", user.Id);
            var orderheaderList1 = _ISP_Call.List <collectionViewModel>("collectionReport", paramter);



            int PageSize = 10;

            return(View(OrderPagination <collectionViewModel> .Create(orderheaderList1.ToList(), PageNumber ?? 1, PageSize)));
        }