using System;
using Quadarax.Foundation.Core.Data.Interface;
namespace Quadarax.Foundation.Core.Data
{
public class Paging : IPaging
{
#region *** Properties ***
///
/// Zero based index
///
public int Page { get; }
///
/// Number of items per page
///
public int PageSize { get; }
///
/// Defines if paging is disabled
///
public bool IsDisabled { get; }
#endregion
#region *** Constructors ***
public Paging(int page, int pageSize)
{
IsDisabled = pageSize == 0;
Page = page;
PageSize = pageSize;
}
public Paging(int takeCount)
{
IsDisabled = takeCount == 0;
Page = 1;
PageSize = takeCount;
}
public Paging()
{
IsDisabled = true;
}
public static Paging NoPaging()
{
return new Paging();
}
#endregion
#region *** Overrides ***
public override string ToString()
{
return $"Paging:IsDisabled={IsDisabled};Page={Page};PageSize={PageSize}";
}
#endregion
}
}