Oddity
Oddity.Models.PaginatedModel< TData > Class Template Reference

Represents an wrapper for a model, providing methods to manage a pagination. More...

Public Member Functions

void SetBuilder (QueryBuilder< TData > builder)
 Sets the builder which will be used to change pages. More...
 
async Task< bool > GoToNextPage ()
 Changes the page to the specified in the NextPage and makes an request to API. More...
 
async Task< bool > GoToPrevPage ()
 Changes the page to the specified in the PrevPage and makes an request to API. More...
 
async Task< bool > GoToFirstPage ()
 Changes the page to the first and makes an request to API. More...
 
async Task< bool > GoToLastPage ()
 Changes the page to the specified in the TotalPages and makes an request to API. More...
 
async Task< bool > GoToPage (uint page)
 Changes the page to the specified in the parameter and makes an request to API. More...
 

Properties

uint TotalDocs [get, set]
 Gets or sets the total number of elements in Data. More...
 
uint Offset [get, set]
 Gets or sets the offset applied to the query. More...
 
uint Limit [get, set]
 Gets or sets the limit applied to the query. More...
 
uint TotalPages [get, set]
 Gets or sets the total number of pages. More...
 
uint Page [get, set]
 Gets or sets the current page. More...
 
uint PagingCounter [get, set]
 Gets or sets the starting serial number of first document. More...
 
bool HasPrevPage [get, set]
 Gets or sets the flag indicating if there is a previous page available to switch. More...
 
bool HasNextPage [get, set]
 Gets or sets the flag indicating if there is a next page available to switch. More...
 
uint PrevPage [get, set]
 Gets or sets the previous page number (only if HasPrevPage is set to true, otherwise null). More...
 
uint NextPage [get, set]
 Gets or sets the next page number (only if HasNextPage is set to true, otherwise null). More...
 
List< TData > Data [get, set]
 Gets or sets the collection of items returned from API for the query filters and parameters. More...
 

Detailed Description

Represents an wrapper for a model, providing methods to manage a pagination.

Template Parameters
TDataType of the data returned from API.
Type Constraints
TData :ModelBase 
TData :IIdentifiable 
TData :new() 

Member Function Documentation

async Task<bool> Oddity.Models.PaginatedModel< TData >.GoToFirstPage ( )

Changes the page to the first and makes an request to API.

Returns
True if the page number was valid and has been changed with success, otherwise false.
async Task<bool> Oddity.Models.PaginatedModel< TData >.GoToLastPage ( )

Changes the page to the specified in the TotalPages and makes an request to API.

Returns
True if the page number was valid and has been changed with success, otherwise false.
async Task<bool> Oddity.Models.PaginatedModel< TData >.GoToNextPage ( )

Changes the page to the specified in the NextPage and makes an request to API.

Returns
True if the page number was valid and has been changed with success, otherwise false.
async Task<bool> Oddity.Models.PaginatedModel< TData >.GoToPage ( uint  page)

Changes the page to the specified in the parameter and makes an request to API.

Parameters
pagePage number to be set.
Returns
True if the page number was valid and has been changed with success, otherwise false.
async Task<bool> Oddity.Models.PaginatedModel< TData >.GoToPrevPage ( )

Changes the page to the specified in the PrevPage and makes an request to API.

Returns
True if the page number was valid and has been changed with success, otherwise false.
void Oddity.Models.PaginatedModel< TData >.SetBuilder ( QueryBuilder< TData >  builder)

Sets the builder which will be used to change pages.

Parameters
builderQuery builder used for page changes.

Property Documentation

List<TData> Oddity.Models.PaginatedModel< TData >.Data
getset

Gets or sets the collection of items returned from API for the query filters and parameters.

bool Oddity.Models.PaginatedModel< TData >.HasNextPage
getset

Gets or sets the flag indicating if there is a next page available to switch.

bool Oddity.Models.PaginatedModel< TData >.HasPrevPage
getset

Gets or sets the flag indicating if there is a previous page available to switch.

uint Oddity.Models.PaginatedModel< TData >.Limit
getset

Gets or sets the limit applied to the query.

uint Oddity.Models.PaginatedModel< TData >.NextPage
getset

Gets or sets the next page number (only if HasNextPage is set to true, otherwise null).

uint Oddity.Models.PaginatedModel< TData >.Offset
getset

Gets or sets the offset applied to the query.

uint Oddity.Models.PaginatedModel< TData >.Page
getset

Gets or sets the current page.

uint Oddity.Models.PaginatedModel< TData >.PagingCounter
getset

Gets or sets the starting serial number of first document.

uint Oddity.Models.PaginatedModel< TData >.PrevPage
getset

Gets or sets the previous page number (only if HasPrevPage is set to true, otherwise null).

uint Oddity.Models.PaginatedModel< TData >.TotalDocs
getset

Gets or sets the total number of elements in Data.

uint Oddity.Models.PaginatedModel< TData >.TotalPages
getset

Gets or sets the total number of pages.


The documentation for this class was generated from the following file: