public PagedList <Customer> GetCustomerAsync(PaginationFIlters paginationFIlters) { try { var query = dataContext.Customers.AsQueryable(); return(new PagedList <Customer>( query, paginationFIlters.PageNumber, paginationFIlters.PageSize)); } catch (Exception ex) { logger.LogError(ex.Message + ":" + ex.StackTrace); throw; } }
public async Task <IActionResult> GetAll(PaginationFIlters paginationFilter) { try { var model = discountService.GetDiscountAsync(paginationFilter); Response.Headers.Add("X-Pagination", model.GetHeader().ToJson()); var outputModel = new DiscountOutputModel { Paging = model.GetHeader(), discountResponses = model.List.Select(x => ToOutputModel(x)).ToList() }; return(Ok(outputModel)); } catch (Exception ex) { logger.LogError(ex.Message + ":" + ex.StackTrace); throw; } }