public static Task <PaginatedResult <TDestination> > Paginate <TDestination>(this IQueryable <TDestination> source, int pageIndex, int pageSize) => PaginatedResult <TDestination> .CreateAsync(source, pageIndex, pageSize);
/// <summary> /// Paginate the results of <see cref="IQueryable{T}"/> and create <see cref="PaginatedResult{T}"/>. /// </summary> /// <typeparam name="T">Type of the stored items.</typeparam> /// <param name="source">The <see cref="IQueryable{T}"/> from which <see cref="PaginatedResult{T}"/> is created from.</param> /// <param name="currentPage">One-based index of the presented page.</param> /// <param name="pageSize">The amount of rows per page.</param> /// <returns>Contents and related important information of a page within <paramref name="source"/>.</returns> public static async Task <PaginatedResult <T> > ToPaginatedResultAsync <T>(this IQueryable <T> source, int currentPage, int pageSize) where T : class { return(await PaginatedResult <T> .CreateAsync(source, currentPage, pageSize)); }