예제 #1
0
        public IHttpActionResult GetAll(string keyword = null, int?pageIndex = null, int?pageSize = null)
        {
            var _totalCount         = 0;
            var _pageSize           = pageSize ?? WebConfigHelper.GetPageSize();
            var _pageIndex          = pageIndex ?? 0;
            var listProduct         = _productCategoryService.GetByPaging(keyword, _pageIndex, _pageSize, out _totalCount, new string[] { "Products" });
            var _totalPage          = (int)Math.Ceiling((decimal)_totalCount / _pageSize);
            var listProductResponse = Mapper.Map <IEnumerable <ProductCategoryListResponse> >(listProduct);
            var paging = new PaginationSet <ProductCategoryListResponse>()
            {
                Items      = listProductResponse,
                Page       = _pageIndex,
                TotalCount = _totalCount,
                TotalPages = _totalPage,
                PageSize   = _pageSize
            };

            return(Ok(paging));
        }
예제 #2
0
        public IHttpActionResult GetAll(string keyword = null, int?pageIndex = null, int?pageSize = null)
        {
            var _pageIndex  = pageIndex ?? 0;
            var _pageSize   = pageSize ?? WebConfigHelper.GetPageSize();
            var _totalCount = 0;

            var brands         = _brandService.GetByPaging(keyword, _pageIndex, _pageSize, out _totalCount);
            var _totalPage     = (int)Math.Ceiling((decimal)_totalCount / _pageSize);
            var brandResponses = Mapper.Map <IEnumerable <BrandListResponse> >(brands);
            var paging         = new PaginationSet <BrandListResponse>()
            {
                Items      = brandResponses,
                Page       = _pageIndex,
                TotalCount = _totalCount,
                TotalPages = _totalPage,
                PageSize   = _pageSize
            };

            return(Ok(paging));
        }