/// <summary> /// Extracts a <see cref="Page{T}"/> from the provided <see cref="IQueryable{T}"/>. /// </summary> /// <typeparam name="T">The type of objects contained in the <see cref="Page{T}"/>.</typeparam> /// <param name="items">The original <see cref="IQueryable{T}"/> from which to extract the <see cref="Page{T}"/>.</param> /// <param name="paginationParameter">The information about the page that should be extracted.</param> /// <param name="cancellationToken">A System.Threading.CancellationToken to observe while waiting for the task to complete.</param> /// <returns> A task that represents the asynchronous operation. The task result contains a new <see cref="Page{T}"/> extracted from the provided collection.</returns> public static Task <Page <T> > PaginateAsync <T>(this IQueryable <T> items, PaginationParameter paginationParameter, CancellationToken cancellationToken = default(CancellationToken)) { return(items.PaginateAsync(paginationParameter.PageNumber, paginationParameter.ItemsPerPage, cancellationToken)); }
/// <summary> /// Extracts a <see cref="Page{T}"/> from the provided <see cref="IEnumerable{T}"/>. /// </summary> /// <typeparam name="T">The type of objects contained in the <see cref="Page{T}"/>.</typeparam> /// <param name="items">The original <see cref="IEnumerable{T}"/> from which to extract the <see cref="Page{T}"/>.</param> /// <param name="paginationParameter">The information about the page that should be extracted.</param> /// <returns>A new <see cref="Page{T}"/> extracted from the provided collection.</returns> public static Page <T> Paginate <T>(this IEnumerable <T> items, PaginationParameter paginationParameter) { return(items.Paginate(paginationParameter.PageNumber, paginationParameter.ItemsPerPage)); }