Merge pull request #63 from janverley/master

Only Skip when pageSize > 0
This commit is contained in:
Biarity 2019-11-16 10:56:04 +10:00 committed by GitHub
commit 0637912098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -337,10 +337,9 @@ namespace Sieve.Services
var pageSize = model?.PageSize ?? _options.Value.DefaultPageSize; var pageSize = model?.PageSize ?? _options.Value.DefaultPageSize;
var maxPageSize = _options.Value.MaxPageSize > 0 ? _options.Value.MaxPageSize : pageSize; var maxPageSize = _options.Value.MaxPageSize > 0 ? _options.Value.MaxPageSize : pageSize;
result = result.Skip((page - 1) * pageSize);
if (pageSize > 0) if (pageSize > 0)
{ {
result = result.Skip((page - 1) * pageSize);
result = result.Take(Math.Min(pageSize, maxPageSize)); result = result.Take(Math.Min(pageSize, maxPageSize));
} }