diff --git a/src/ApplicationCore/Specifications/CatalogFilterPaginatedSpecification.cs b/src/ApplicationCore/Specifications/CatalogFilterPaginatedSpecification.cs index d6d577a..abc3e04 100644 --- a/src/ApplicationCore/Specifications/CatalogFilterPaginatedSpecification.cs +++ b/src/ApplicationCore/Specifications/CatalogFilterPaginatedSpecification.cs @@ -7,7 +7,11 @@ namespace Microsoft.eShopWeb.ApplicationCore.Specifications { public CatalogFilterPaginatedSpecification(int skip, int take, int? brandId, int? typeId) : base() - { + { + if (take == 0) + { + take = int.MaxValue; + } Query .Where(i => (!brandId.HasValue || i.CatalogBrandId == brandId) && (!typeId.HasValue || i.CatalogTypeId == typeId)) diff --git a/src/BlazorAdmin/Services/CatalogItemService.cs b/src/BlazorAdmin/Services/CatalogItemService.cs index a33afae..bc75c4c 100644 --- a/src/BlazorAdmin/Services/CatalogItemService.cs +++ b/src/BlazorAdmin/Services/CatalogItemService.cs @@ -84,9 +84,8 @@ namespace BlazorAdmin.Services _logger.LogInformation("Fetching catalog items from API."); var brandListTask = _brandService.List(); - var typeListTask = _typeService.List(); - //TODO: Need to change the api to support full list - var itemListTask = _httpService.HttpGet($"catalog-items?PageSize=100"); + var typeListTask = _typeService.List(); + var itemListTask = _httpService.HttpGet($"catalog-items"); await Task.WhenAll(brandListTask, typeListTask, itemListTask); var brands = brandListTask.Result; var types = typeListTask.Result; diff --git a/src/PublicApi/CatalogItemEndpoints/ListPaged.cs b/src/PublicApi/CatalogItemEndpoints/ListPaged.cs index 75d1bd2..c997d43 100644 --- a/src/PublicApi/CatalogItemEndpoints/ListPaged.cs +++ b/src/PublicApi/CatalogItemEndpoints/ListPaged.cs @@ -56,7 +56,15 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints { item.PictureUri = _uriComposer.ComposePicUri(item.PictureUri); } - response.PageCount = int.Parse(Math.Ceiling((decimal)totalItems / request.PageSize).ToString()); + + if (request.PageSize > 0) + { + response.PageCount = int.Parse(Math.Ceiling((decimal)totalItems / request.PageSize).ToString()); + } + else + { + response.PageCount = totalItems > 0 ? 1 : 0; + } return Ok(response); }