本文整理汇总了C#中Pager.GetPagedItems方法的典型用法代码示例。如果您正苦于以下问题:C# Pager.GetPagedItems方法的具体用法?C# Pager.GetPagedItems怎么用?C# Pager.GetPagedItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pager
的用法示例。
在下文中一共展示了Pager.GetPagedItems方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetShoePage
public ShoePage GetShoePage(ShoePage page)
{
IEnumerable<Shoe> shoes = GetShoes(page.Athlete);
if(page.Active)
{
shoes = shoes.Where(shoe => shoe.Active);
}
var pager = new Pager<Shoe>(shoes.AsQueryable(), page.Start,page.PageSize);
page.Shoes = pager.GetPagedItems().ToList();
return page;
}
示例2: GetHealthHistory
public AthleteHealthQuery GetHealthHistory(AthleteHealthQuery query)
{
var healths = DataContext.Queryable<AthleteHealth>().Where(x => x.Athlete.Equals(query.Athlete));
var pager = new Pager<AthleteHealth>(
healths,
query.PagingData.PageOffset,
query.PagingData.PageSize,
query.PagingData.RequestsLastPage);
query.AthleteHealthHistory = pager.GetPagedItems().ToList();
query.PagingData.TotalCount = pager.TotalCount;
query.PagingData.PageOffset = pager.PageOffset;
return query;
}
示例3: GetAthleteRuns
public IEnumerable<Run> GetAthleteRuns(int start, int page)
{
var pager = new Pager<Run>(_runs.AsQueryable(), start, page);
return pager.GetPagedItems();
}
示例4: GetRuns
public RunsPage GetRuns(RunsPage page)
{
var runs = GetRuns(page.Athlete);
if (page.ByDateTime.HasValue)
{
var clientDate = page.ByDateTime.Value.Date;
var year = clientDate.Year;
var month = clientDate.Month;
var day = clientDate.Day;
runs = runs.Where(run => run.Start.Year == year && run.Start.Month == month && run.Start.Day == day);
}
var sortSuffix = page.Ascending ? " asc" : " desc";
var orderBy = page.OrderByExpression + sortSuffix;
var pager =
new Pager<Run>(
runs.OrderBy(orderBy),
page.Start,
page.Page,
page.RequestsLastPage);
page.Runs = pager.GetPagedItems().ToList();
page.Start = pager.PageOffset;
page.RunCount = pager.TotalCount;
return page;
}