20 lines
481 B
C#
Executable File
20 lines
481 B
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Auth.Contracts.DTOs;
|
|
using Auth.Contracts;
|
|
|
|
namespace Auth.Core.Utility;
|
|
|
|
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);
|
|
}
|
|
}
|