19 lines
465 B
C#
Executable File
19 lines
465 B
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Generic.Contracts.Generics;
|
|
|
|
namespace Generic.Services;
|
|
|
|
public static class Pagination<T>
|
|
where T : class
|
|
{
|
|
public static IQueryable<T> Paginate(IQueryable<T> query, Pagination pagination)
|
|
{
|
|
return query
|
|
.Skip((pagination.CurrentPage.Value - 1) * pagination.PageSize.Value)
|
|
.Take(pagination.PageSize.Value);
|
|
}
|
|
}
|