本文整理汇总了C#中System.Web.Mvc.UrlHelper.PackageList方法的典型用法代码示例。如果您正苦于以下问题:C# UrlHelper.PackageList方法的具体用法?C# UrlHelper.PackageList怎么用?C# UrlHelper.PackageList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Mvc.UrlHelper
的用法示例。
在下文中一共展示了UrlHelper.PackageList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PackageListViewModel
public PackageListViewModel(
IQueryable<Package> packages,
DateTime? indexTimestampUtc,
string searchTerm,
int totalCount,
int pageIndex,
int pageSize,
UrlHelper url,
string curatedFeed)
{
// TODO: Implement actual sorting
IEnumerable<ListPackageItemViewModel> items = packages.ToList().Select(pv => new ListPackageItemViewModel(pv));
PageIndex = pageIndex;
IndexTimestampUtc = indexTimestampUtc;
PageSize = pageSize;
TotalCount = totalCount;
SearchTerm = searchTerm;
int pageCount = (TotalCount + PageSize - 1) / PageSize;
var pager = new PreviousNextPagerViewModel<ListPackageItemViewModel>(
items,
PageIndex,
pageCount,
page => curatedFeed == null ?
url.PackageList(page, searchTerm) :
url.CuratedPackageList(page, searchTerm, curatedFeed)
);
Items = pager.Items;
FirstResultIndex = 1 + (PageIndex * PageSize);
LastResultIndex = FirstResultIndex + Items.Count() - 1;
Pager = pager;
}
示例2: PackageListViewModel
public PackageListViewModel(IQueryable<Package> packages,
string searchTerm,
string sortOrder,
int totalCount,
int pageIndex,
int pageSize,
UrlHelper url,
bool includePrerelease)
{
// TODO: Implement actual sorting
IEnumerable<ListPackageItemViewModel> items;
using (MiniProfiler.Current.Step("Querying and mapping packages to list"))
{
items = packages.ToList()
.Select(pv => new ListPackageItemViewModel(pv, needAuthors: false));
}
PageIndex = pageIndex;
PageSize = pageSize;
TotalCount = totalCount;
SortOrder = sortOrder;
SearchTerm = searchTerm;
int pageCount = (TotalCount + PageSize - 1) / PageSize;
var pager = new PreviousNextPagerViewModel<ListPackageItemViewModel>(
items,
PageIndex,
pageCount,
page => url.PackageList(page, sortOrder, searchTerm, includePrerelease)
);
Items = pager.Items;
FirstResultIndex = 1 + (PageIndex * PageSize);
LastResultIndex = FirstResultIndex + Items.Count() - 1;
Pager = pager;
IncludePrerelease = includePrerelease ? "true" : null;
}
示例3: PackageListViewModel
public PackageListViewModel(IQueryable<Package> packages,
string searchTerm,
string sortOrder,
int pageIndex,
int pageSize,
UrlHelper url)
{
// TODO: Implement actual sorting
IEnumerable<ListPackageItemViewModel> items;
using (MiniProfiler.Current.Step("Querying and mapping packages to list"))
{
items = packages.SortBy(GetSortExpression(sortOrder))
.Skip(pageIndex * pageSize)
.Take(pageSize)
.ToList()
.Select(pv => new ListPackageItemViewModel(pv));
}
PageIndex = pageIndex;
PageSize = pageSize;
TotalCount = packages.Count();
SortOrder = sortOrder;
SearchTerm = searchTerm;
int pageCount = (TotalCount + PageSize - 1) / PageSize;
var pager = new PreviousNextPagerViewModel<ListPackageItemViewModel>(
items,
PageIndex,
pageCount,
page => url.PackageList(page, sortOrder, searchTerm)
);
Items = pager.Items;
FirstResultIndex = 1 + (PageIndex * PageSize);
LastResultIndex = FirstResultIndex + Items.Count() - 1;
Pager = pager;
}