Files
sanstudent/Common/Pagination/PaginationExtensions.cs
aherman-san b8f03bf6d3
All checks were successful
SanStudent Multi-Project Deployment / deploy-api (push) Successful in 41s
SanStudent Multi-Project Deployment / deploy-frontadmin (push) Successful in 41s
SanStudent Multi-Project Deployment / deploy-frontstudent (push) Successful in 40s
Add project
2026-03-07 11:14:26 +01:00

16 lines
508 B
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace Common.Pagination;
public static class PaginationExtensions
{
public static string ToPaginationSummary(this PaginationProperties props)
{
var before = (props.PageSize * (props.PageNumber - 1)) + 1;
var after = Math.Min((props.PageSize * props.PageNumber), props.TotalItems);
return props.TotalItems == 0 ? $"{props.Text}: brak" : $"{props.Text}: {before}-{after} z {props.TotalItems}";
}
}