Issue/567 (#568)

* Correctly manage page count when Page size = 0

* make =>TODO: Need to change the api to support full list
Manage to support full list when pagesize is unknow
This commit is contained in:
Cédric Michel
2021-10-24 23:41:36 +02:00
committed by GitHub
parent cafd5d0544
commit 5b5abd9c8d
3 changed files with 16 additions and 5 deletions

View File

@@ -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);
}