Esempio n. 1
0
        public async Task <IActionResult> GetAllProductByPageIndex(ProductGetInputModel inputModel)
        {
            var resultData = await productService.GetAllProductByPageIndex(inputModel);

            if (resultData == null)
            {
                return(NotFound());
            }
            return(Ok(resultData));
        }
Esempio n. 2
0
        public async Task <PagedList <ProductOutputModel> > GetAllProductByPageIndex(ProductGetInputModel inputModel)
        {
            var productsRoot = await this.productRepository.GetAllProdcutByPageIndexAsync(inputModel.Term, inputModel.PageIndex, inputModel.PageSize);

            var resultProduct = Mapper.Map <List <ProductOutputModel> >(productsRoot.Sources);

            return(new PagedList <ProductOutputModel>(
                       resultProduct,
                       productsRoot.TotalCount,
                       productsRoot.CurrentPage,
                       productsRoot.PageSize));
        }