Files
Umbraco-CMS/src/Umbraco.Core/PaginationHelper.cs
Nikolaj Geisle b96302a9da V13: Audit log controller (#13842)
* Implement AuditLogByTypeViewModel

* Add GetLogs endpoint

* Implement AuditLogViewModelFactory and use it

* Remove mapping and do that in ViewModelFactory

* Add Skip take pagination to AuditService.cs

* Get entity key from repository

* Only create filter if sincedate has value

* Refactor to handle enitity not being found

* Add by type route

* Rename AuditLogViewModel.cs

* Add CreateAuditLogWithUsernameViewModel method to factory

* Rename method in factory

* Fix up controllers to use async service

* Refactor to use pagedModel

* Update sincedate query

* Add FIXME

* Move entity call in scope

* Rename methods to async

* Update src/Umbraco.Core/PaginationHelper.cs

* Refactor to use IActionResult

* Audit log in two words

* Fix up by key

* Fix routing

* Fix ByType

* Update ByType routing

* Refactor to also pass DateStamp

* Add Key to WithUserNameViewModel

* Refactor extension method to call new GetAsync method

* use new GetAsync method

* Rename models and implement base class

* Update OpenApi.json

---------

Co-authored-by: Zeegaan <nge@umbraco.dk>
Co-authored-by: Nikolaj <nikolajlauridsen@protonmail.ch>
2023-02-23 11:32:24 +01:00

16 lines
425 B
C#

namespace Umbraco.Cms.Core;
public static class PaginationHelper
{
internal static void ConvertSkipTakeToPaging(int skip, int take, out long pageNumber, out int pageSize)
{
if (skip % take != 0)
{
throw new ArgumentException("Invalid skip/take, Skip must be a multiple of take - i.e. skip = 10, take = 5");
}
pageSize = take;
pageNumber = skip / take;
}
}