|
|
@ -123,7 +123,13 @@ namespace NzbDrone.Api.REST
|
|
|
|
|
|
|
|
|
|
|
|
Get[ROOT_ROUTE] = options =>
|
|
|
|
Get[ROOT_ROUTE] = options =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var resource = GetResourcePaged(ReadPagingResourceFromRequest());
|
|
|
|
var pagingSpec = ReadPagingResourceFromRequest();
|
|
|
|
|
|
|
|
if (pagingSpec.Page == 0 && pagingSpec.PageSize == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var all = GetResourceAll();
|
|
|
|
|
|
|
|
return all.AsResponse();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var resource = GetResourcePaged(pagingSpec);
|
|
|
|
return resource.AsResponse();
|
|
|
|
return resource.AsResponse();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -214,15 +220,12 @@ namespace NzbDrone.Api.REST
|
|
|
|
private PagingResource<TResource> ReadPagingResourceFromRequest()
|
|
|
|
private PagingResource<TResource> ReadPagingResourceFromRequest()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int pageSize;
|
|
|
|
int pageSize;
|
|
|
|
if (!int.TryParse(Request.Query.PageSize.ToString(), out pageSize))
|
|
|
|
int.TryParse(Request.Query.PageSize.ToString(), out pageSize);
|
|
|
|
{
|
|
|
|
if (pageSize == 0) pageSize = 0;
|
|
|
|
pageSize = 100000;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pageSize == 0) pageSize = 10;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int page;
|
|
|
|
int page;
|
|
|
|
int.TryParse(Request.Query.Page.ToString(), out page);
|
|
|
|
int.TryParse(Request.Query.Page.ToString(), out page);
|
|
|
|
if (page == 0) page = 1;
|
|
|
|
if (page == 0) page = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pagingResource = new PagingResource<TResource>
|
|
|
|
var pagingResource = new PagingResource<TResource>
|
|
|
|