本文整理汇总了C#中IPagedList.Select方法的典型用法代码示例。如果您正苦于以下问题:C# IPagedList.Select方法的具体用法?C# IPagedList.Select怎么用?C# IPagedList.Select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPagedList
的用法示例。
在下文中一共展示了IPagedList.Select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromAuctions
public static AccountMyAuctionsViewModel FromAuctions(IPagedList<Auction> auctions,
string titleFilter,
int createdInDays,
AuctionStatusFilter currentStatusFilter)
{
Contract.Requires(auctions != null);
var items = auctions.Select(x => new AccountMyAuctionsViewModel.Item
{
Id = x.Id,
Title = x.Title,
CategoryName = x.Category.Name,
CategoryId = x.Category.Id,
Status = x.Status,
TimeTillEnd = x.EndDate - DateTime.Now,
BuyoutPrice = x.BuyoutPrice,
BestOffer = x.BestOffer != null ? x.BestOffer.Money : null
});
return new AccountMyAuctionsViewModel
{
Auctions = new StaticPagedList<AccountMyAuctionsViewModel.Item>(items, auctions),
TitleFilter = titleFilter,
CreatedIn = TimeSpan.FromDays(createdInDays),
CurrentStatusFilter = currentStatusFilter
};
}
示例2: RegistryItemsPage
public RegistryItemsPage(IPagedList<Gift> gifts, IEnumerable<Category> categories, int pageSize,int selectedCategory)
{
Gifts =gifts.Select((gift, i) => new GiftRow {Item = gift, IsFirst = i == 0});
Categories = categories.ToList();
TotalNumberOfItems = gifts.TotalItemCount;
PageNumber = gifts.PageNumber;
PageCount = gifts.PageCount;
FirstItemIndex = gifts.FirstItemIndex;
LastItemIndex = gifts.LastItemIndex;
PageSize = pageSize;
SelectedCategoryId = selectedCategory;
}
示例3: FromAuctions
public static CategoryIndexViewModel FromAuctions(IPagedList<Auction> auctions,
AuctionSortOrder currentSortOrder,
int? categoryId = null)
{
Contract.Requires(auctions != null);
return new CategoryIndexViewModel
{
CategoryId = categoryId,
Auctions = new StaticPagedList<AuctionViewModel>(auctions.Select(AuctionViewModelMapper.FromAuction),
auctions),
CurrentSortOrder = currentSortOrder,
};
}
示例4: FromUsers
public static UsersIndexViewModel FromUsers(IPagedList<User> users, UserSortOrder currentSortOrder)
{
Contract.Requires(users != null);
var items = users.Select(x => new UsersIndexViewModel.Item
{
Id = x.Id,
UserName = x.UserName,
RealName = x.FullName,
IsBanned = x.IsBanned,
BanExpiryTime = x.LockoutEndDateUtc.HasValue ? x.LockoutEndDateUtc.Value.ToLocalTime() : (DateTime?)null
});
return new UsersIndexViewModel
{
Users = new StaticPagedList<UsersIndexViewModel.Item>(items, users),
CurrentSortOrder = currentSortOrder
};
}
示例5: Convert
private IEnumerable<SaleProductModel> Convert(IPagedList<productDto> sources)
{
if (sources == null) return null;
return sources.Select(t =>
{
var data = new SaleProductModel()
{
brandname = t.brand.name,
categoryname = t.category.name,
gendername = t.gender.name,
unitprice = t.unitprice,
code = t.code,
name = t.name,
imgpath = t.imagemain,
productid = t.key
};
data.details.AddRange(t.v_stocks.Select(o => new SaleProductDetailModel()
{
productid = t.key,
size = o.size.code,
displaysize = o.size.displaycode,
sizeid = o.sizeid,
stockquantity = o.stockquantity
}));
return data;
});
}
示例6: GetPagedComplaintList
private IPagedList<ComplaintViewModel> GetPagedComplaintList(IPagedList<Complaint> complaints)
{
var complaintViewModels = complaints.Select(c => _complaintBuilder.BuildViewModel(c)).ToList();
return new PagedList<ComplaintViewModel>(complaintViewModels, complaints.PageIndex, complaints.PageSize, complaints.TotalItemCount);
}