public async Task <PagedResultBase <DigitalAccountTransactionModel> > GetFilterAsync(DateTime startDate, DateTime endDate, int page, int pageSize) { var query = _appDbContext.DigitalAccountTransactions.Where(c => c.CreatedDate.Date >= startDate.Date && c.CreatedDate.Date <= endDate.Date); return(await PaginationService.GetPagination(query, page, pageSize)); }
public async Task <Pagination <ProductListResponseModel> > GetAllProducts(ProductListRequestModel requestModel) { var parameters = new DynamicParameters(); parameters.Add("@PageSize", requestModel.PageSize); parameters.Add("@Offset", requestModel.Page); await using var connection = _dbConnection.CreateDbConnection(); var products = await connection.QueryMultipleAsync(ProductQuery(requestModel), parameters); var productListResponseModel = new ProductListResponseModel(); var productResult = products.Read <ProductServiceResponseModel, CategoryServiceResponseModel, ProductListResponseModel> ((product, category) => { product.CategoryServiceResponseModel = category; productListResponseModel.ProductServiceResponseModel = product; return(productListResponseModel); } , splitOn: "CategoryId"); var totalItemCount = products.Read <int>().FirstOrDefault(); var productResponse = PaginationService.GetPagination( productResult.AsQueryable(), requestModel.Page.Value, string.Empty, true, requestModel.PageSize.Value); return(productResponse); }
public void OnActionExecuting(ActionExecutingContext context) { var query = context.HttpContext.Request.Query; PageNumber = query["pageNumber"].Count == 0 ? 0 : int.Parse(query["pageNumber"].ToString()); PageSize = query["pageSize"].Count == 0 ? 50 : int.Parse(query["pageSize"].ToString()); var result = PaginationService.GetPagination(_transactionService.GetQueryable(), PageNumber ?? 0, PageSize ?? 50); context.HttpContext.Items.Add("result", result); }
public async Task <PagedResultBase <DigitalAccountModel> > GetAllAsync(int page, int pageSize) { return(await PaginationService.GetPagination(_appDbContext.DigitalAccounts, page, pageSize)); }