예제 #1
0
        public async Task <Pageable <ProductDto> > SearchAsync(ProductQuerySearch querySearch)
        {
            var query = _applicationContext.GetQuery <Product>(querySearch).ProjectTo <ProductDto>(_mapper.ConfigurationProvider);

            var totalItem = query.Count();

            var items = await query.ApplyPaging(querySearch.GetSkip(), querySearch.GetTake()).ToListAsync();

            return(new Pageable <ProductDto>(totalItem, querySearch.GetTake(), querySearch.PageIndex, items));
        }
예제 #2
0
 public async Task <IActionResult> Get([FromQuery] ProductQuerySearch querySearch)
 {
     return(Ok(await _service.SearchAsync(querySearch)));
 }