Beispiel #1
0
        public async Task <Response <PagedResult <ProductDTO> > > GetPagedQuery()
        {
            var a = await _productRepository.PagedQueryAsync(0, 10);

            var b = _mapper.MapPagedResult <ProductDTO>(a);

            return(new Response <PagedResult <ProductDTO> >(b));
        }
Beispiel #2
0
        public async Task <PagedResult <ProductOut> > PagedQueryAsync(string keyword, int page, int limit)
        {
            keyword = keyword?.Trim();

            PagedResult <Product> result;

            if (string.IsNullOrWhiteSpace(keyword))
            {
                result = await _dbContext.Set <Product>().PagedQueryAsync(page, limit,
                                                                          null,
                                                                          new OrderCondition <Product, DateTimeOffset?>(x => x.LastModificationTime, true));
            }
            else
            {
                result = await _dbContext.Set <Product>().PagedQueryAsync(page, limit,
                                                                          x => x.Name.Contains(keyword),
                                                                          new OrderCondition <Product, DateTimeOffset?>(x => x.LastModificationTime, true));
            }

            return(_mapper.MapPagedResult <ProductOut>(result));
        }
Beispiel #3
0
        public async Task <PagedResult <ProductOut> > PagedQuery1Async(string keyword, int page, int limit)
        {
            var @out = await _productQuery.PagedQueryAsync(keyword, page, limit);

            return(_mapper.MapPagedResult <ProductOut>(@out));
        }