Try your search with a different keyword or use * as a wildcard.
//Contributor : MVCContrib
using Nop.Core;
using Nop.Web.Framework.Models;
namespace Nop.Web.Framework.UI.Paging;
///
/// Base class for pageable models
///
public abstract record BasePageableModel : BaseNopModel, IPageableModel
{
#region Methods
///
/// Ctor
///
/// Type
/// Entities (models)
public virtual void LoadPagedList(IPagedList pagedList)
{
FirstItem = (pagedList.PageIndex * pagedList.PageSize) + 1;
HasNextPage = pagedList.HasNextPage;
HasPreviousPage = pagedList.HasPreviousPage;
LastItem = Math.Min(pagedList.TotalCount, ((pagedList.PageIndex * pagedList.PageSize) + pagedList.PageSize));
PageNumber = pagedList.PageIndex + 1;
PageSize = pagedList.PageSize;
TotalItems = pagedList.TotalCount;
TotalPages = pagedList.TotalPages;
}
#endregion
#region Properties
///
/// The current page index (starts from 0)
///
public int PageIndex
{
get
{
if (PageNumber > 0)
return PageNumber - 1;
return 0;
}
}
///
/// The current page number (starts from 1)
///
public int PageNumber { get; set; }
///
/// The number of items in each page.
///
public int PageSize { get; set; }
///
/// The total number of items.
///
public int TotalItems { get; set; }
///
/// The total number of pages.
///
public int TotalPages { get; set; }
///
/// The index of the first item in the page.
///
public int FirstItem { get; set; }
///
/// The index of the last item in the page.
///
public int LastItem { get; set; }
///
/// Whether there are pages before the current page.
///
public bool HasPreviousPage { get; set; }
///
/// Whether there are pages after the current page.
///
public bool HasNextPage { get; set; }
#endregion
}