Add project
This commit is contained in:
15
Common/Pagination/PaginationExtensions.cs
Normal file
15
Common/Pagination/PaginationExtensions.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
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}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user