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)); }
public async Task <IActionResult> Get([FromQuery] ProductQuerySearch querySearch) { return(Ok(await _service.SearchAsync(querySearch))); }