本文整理汇总了C#中PagerRequest类的典型用法代码示例。如果您正苦于以下问题:C# PagerRequest类的具体用法?C# PagerRequest怎么用?C# PagerRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PagerRequest类属于命名空间,在下文中一共展示了PagerRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: List
public ActionResult List(PagerRequest request,SpecialTopicListSearchOption search)
{
int totalCount;
var data = _specialTopicRepository.Get(e =>(!search.PId.HasValue || e.Id== search.PId.Value)
&& (string.IsNullOrEmpty(search.Name) || e.Name.ToLower().StartsWith(search.Name.ToLower()))
&& (!search.Status.HasValue || e.Status == (int)search.Status.Value)
&& e.Status!=(int)DataStatus.Deleted
, out totalCount
, request.PageIndex
, request.PageSize
, e => {
if (!search.OrderBy.HasValue)
return e.OrderByDescending(o=>o.CreatedDate);
else
{
switch (search.OrderBy.Value)
{
case GenericOrder.OrderByCreateUser:
return e.OrderByDescending(o=>o.CreatedUser);
case GenericOrder.OrderByName:
return e.OrderByDescending(o=>o.Name);
case GenericOrder.OrderByCreateDate:
default:
return e.OrderByDescending(o=>o.CreatedDate);
}
}
});
var vo = MappingManager.SpecialTopicViewMapping(data.ToList());
var v = new SpecialTopicCollectionViewModel(request, totalCount) { SpecialTopics = vo.ToList() };
ViewBag.SearchOptions = search;
return View("List", v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:35,代码来源:SpecialTopicController.cs
示例2: List
public ActionResult List(PagerRequest request,HotwordSearchOption search)
{
int totalCount;
var data = _hotwordRepo.Get(e => (!search.Type.HasValue || e.Type == search.Type.Value)
&& (string.IsNullOrEmpty(search.Word) || e.Word.Contains(search.Word))
&& e.Status != (int)DataStatus.Deleted
, out totalCount
, request.PageIndex
, request.PageSize
, e =>
{
if (!search.OrderBy.HasValue)
return e.OrderByDescending(o => o.CreatedDate);
else
{
switch (search.OrderBy.Value)
{
case GenericOrder.OrderByCreateUser:
return e.OrderByDescending(o => o.CreatedUser);
case GenericOrder.OrderByName:
return e.OrderByDescending(o => o.Word);
case GenericOrder.OrderByCreateDate:
default:
return e.OrderByDescending(o => o.CreatedDate);
}
}
});
var models = from d in data.ToList()
select new HotwordViewModel().FromEntity<HotwordViewModel>(d);
return View("List", new Pager<HotwordViewModel>(request, totalCount) { Data=models});
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:35,代码来源:HotwordController.cs
示例3: List
public ActionResult List(PagerRequest request,SectionSearchOption search)
{
int totalCount;
var linq = _sectionRepo.Get(s => (!search.SId.HasValue || search.SId.Value == s.Id) &&
(string.IsNullOrEmpty(search.Name) || s.Name.StartsWith(search.Name)) &&
(!search.BrandId.HasValue || search.BrandId.Value == s.BrandId) &&
(!search.StoreId.HasValue || search.StoreId.Value == s.StoreId) &&
s.Status!=(int)DataStatus.Deleted
, out totalCount
, request.PageIndex
, request.PageSize
, e => e.OrderByDescending(o => o.CreateDate));
var data = linq.Join(_storeRepo.GetAll(), o => o.StoreId, i => i.Id, (o, i) => new { S = o, Store = i })
.Join(_brandRepo.GetAll(), o => o.S.BrandId, i => i.Id, (o, i) => new { S = o.S, Store = o.Store, B = i })
.ToList()
.Select(l => new SectionViewModel().FromEntity<SectionViewModel>(l.S, p=>{
p.Store = new StoreViewModel().FromEntity<StoreViewModel>(l.Store);
p.Brand = new BrandViewModel().FromEntity<BrandViewModel>(l.B);
}));
var v = new Pager<SectionViewModel>(request, totalCount) { Data = data.ToList() };
return View("List", v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:25,代码来源:SectionController.cs
示例4: ListP
public JsonResult ListP(CategorySearchOption search, PagerRequest request)
{
int totalCount;
var linq = Context.Set<CategoryEntity>().Where(p => (string.IsNullOrEmpty(search.Name) || p.Name.Contains(search.Name)) &&
(!search.PId.HasValue || p.ExCatId == search.PId.Value) &&
p.Status != (int)DataStatus.Deleted);
var linq2 = linq.GroupJoin(Context.Set<CategoryMapEntity>().Where(u => u.Status != (int)DataStatus.Deleted),
o => o.ExCatId,
i => i.CatId,
(o, i) => new { O = o, C = i })
;
totalCount = linq2.Count();
var skipCount = (request.PageIndex - 1) * request.PageSize;
var linq3 = skipCount == 0 ? linq2.Take(request.PageSize) : linq2.Skip(skipCount).Take(request.PageSize);
var vo = from l in linq3.ToList()
select new CategoryViewModel().FromEntity<CategoryViewModel>(l.O, p =>
{
p.ShowCategories = l.C.Select(c => new ShowCategoryViewModel() {
ShowChannel = c.ShowChannel
}).ToList() ;
});
var v = new Pager<CategoryViewModel>(request, totalCount) { Data = vo.ToList() };
return Json(v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:30,代码来源:CategoryController.cs
示例5: ProductListP
public ActionResult ProductListP(ProductSearchViewModel search, PagerRequest request)
{
int totalCount;
var linq = Context.Set<ProductEntity>().Where(p => p.SkuCode == search.SkuCode && p.Status != (int)DataStatus.Deleted)
.Join(Context.Set<InventoryEntity>(), o => o.Id, i => i.ProductId, (o, i) => new { P = o, I = i })
.Join(Context.Set<ProductPropertyValueEntity>(), o => o.I.PColorId, i => i.Id, (o, i) => new { P = o.P, I = o.I, Color = i })
.Join(Context.Set<ProductPropertyValueEntity>(), o => o.I.PSizeId, i => i.Id, (o, i) => new { P = o.P, I = o.I, Color = o.Color, Size = i });
totalCount = linq.Count();
var skipCount = (request.PageIndex - 1) * request.PageSize;
linq = skipCount == 0 ? linq.OrderBy(l => l.P.Id).Take(request.PageSize) : linq.OrderBy(l => l.P.Id).Skip(skipCount).Take(request.PageSize);
var vo = new List<dynamic>();
foreach (var l in linq)
{
vo.Add(new {
Id = l.P.Id,
Name = l.P.Name,
ColorValueName = l.Color.ValueDesc,
SizeValueName = l.Size.ValueDesc,
Amount = l.I.Amount,
GenerateId = search.PackageType==(int)WxPackageType.Product?l.P.Id:l.I.Id,
PackageType = search.PackageType
});
}
var v = new Pager<dynamic>(request, totalCount) { Data = vo.ToList() };
return Json(v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:34,代码来源:BarCodeController.cs
示例6: List
public ActionResult List(PagerRequest request, int? sort, SourceType? sourceType, int? sourceId)
{
int totalCount;
var sortOrder = sort ==null?ResourceSortOrder.CreateDate:(ResourceSortOrder)sort.Value;
List<ResourceEntity> data;
if (sourceType == null)
{
data = _resourceRepository.GetPagedList(request, out totalCount, sortOrder);
}
else
{
data = _resourceRepository.GetPagedList(request, out totalCount, sortOrder, sourceType, sourceId);
}
var vo = MappingManager.ResourceViewMapping(data);
var v = new ResourceCollectionViewModel(request, totalCount) { Resources = vo.ToList() };
var dto = new ListDto
{
ResourceCollectionViewModel = v,
Sort = sort,
SourceId = sourceId,
SourceType = sourceType
};
return View("List", dto);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:28,代码来源:ResourceController.cs
示例7: Get
private FavoriteCollectionResponse Get(float version, int userId, PagerRequest pagerRequest, CoordinateInfo coordinate, FavoriteSortOrder sortOrder, SourceType sourceType)
{
FavoriteCollectionResponse response;
int totalCount;
if (version >= 2.1)
{
var entitys = _favoriteRepository.Get(userId, pagerRequest, out totalCount, sortOrder, sourceType);
var list = MappingManager.FavoriteCollectionResponseMapping(entitys, coordinate);
response = new FavoriteCollectionResponse(pagerRequest, totalCount) { Favorites = list };
}
else
{
var entitys = _favoriteRepository.GetPagedList(userId, pagerRequest, out totalCount, sortOrder, sourceType);
response = MappingManager.FavoriteCollectionResponseMapping(entitys, coordinate);
response.Index = pagerRequest.PageIndex;
response.Size = pagerRequest.PageSize;
response.TotalCount = totalCount;
}
return response;
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:25,代码来源:FavoriteDataService.cs
示例8: List
public ActionResult List(PagerRequest request)
{
int totalCount;
var jobs = new ProUploadService(this).JobList(request.PageIndex,request.PageSize,out totalCount);
return View(new Pager<ProductUploadJob>(request,totalCount){
Data = jobs
});
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:8,代码来源:ProBulkUploadController.cs
示例9: List
public ActionResult List(ProductSearchOption search, PagerRequest request)
{
int totalCount;
var vo = internalSearch(search, request,out totalCount);
var v = new ProductCollectionViewModel(request, totalCount) { Products = vo.ToList() };
ViewBag.SearchOptions = search;
return View(v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:8,代码来源:ProductController.cs
示例10: List
public ActionResult List(PagerRequest request, int? sort)
{
int totalCount;
var sortOrder = (FeedbackSortOrder)(sort ?? 0);
var data = _feedbackRepository.GetPagedList(request, out totalCount, sortOrder);
var vo = MappingManager.FeedbackViewMapping(data);
var v = new FeedbackCollectionViewModel(request, totalCount) { Feedbacks = vo.ToList() };
return View("List", v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:11,代码来源:FeedbackController.cs
示例11: GetList
private IEnumerable<BillEntity> GetList(PagerRequest pagerRequest, out int totalCount, BillFilterOptions filterOptions, BillSortOptions sortOptions)
{
var count = 0;
var t = ServiceInvoke(v => v.BillRepository.Get(Filler(filterOptions), out count, pagerRequest.PageIndex,
pagerRequest.PageSize, OrderBy(sortOptions)));
totalCount = count;
return t;
}
开发者ID:ngnono,项目名称:NGnono.FMNote,代码行数:11,代码来源:BillController.cs
示例12: ProductByBrand
public ActionResult ProductByBrand(PagerRequest request, ReportByProductBrandOption search)
{
if (!ModelState.IsValid)
{
ViewBag.SearchOptions = search;
return View();
}
var prods = searchProduct(search);
var v = new Pager<ProductByBrandReportViewModel>(request, prods.Count()) { Data = prods.ToList() };
ViewBag.SearchOptions = search;
return View(v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:12,代码来源:ReportController.cs
示例13: List
public ActionResult List(PagerRequest request, int? sort)
{
int totalCount;
var sortOrder = (TagSortOrder)(sort ?? 0);
var data = _tagRepository.GetPagedList(request, out totalCount, sortOrder);
var vo = MappingManager.TagViewMapping(data);
var v = new TagCollectionViewModel(request, totalCount) { Tags = vo.ToList() };
return View("List", v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:12,代码来源:TagController.cs
示例14: StoreCouponUsage
public ActionResult StoreCouponUsage(PagerRequest request, StoreCouponUsageOption search)
{
if (!ModelState.IsValid)
{
ViewBag.SearchOptions = search;
return View();
}
var prods = searchCouponLog(search);
var v = new Pager<StoreCouponUsageViewModel>(request, prods.Count()) { Data = prods.ToList() };
ViewBag.SearchOptions = search;
return View(v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:12,代码来源:ReportController.cs
示例15: ListP
public JsonResult ListP(OrderSearchOption search, PagerRequest request)
{
int totalCount;
search.CurrentUser = CurrentUser.CustomerId;
search.CurrentUserRole = CurrentUser.Role;
var dbContext = _orderRepo.Context;
var linq = dbContext.Set<OrderEntity>().Where(p => (string.IsNullOrEmpty(search.OrderNo) || p.OrderNo == search.OrderNo) &&
(!search.CustomerId.HasValue || p.CustomerId == search.CustomerId.Value) &&
(!search.Status.HasValue || p.Status == (int)search.Status.Value) &&
(!search.Store.HasValue || p.StoreId == search.Store.Value) &&
(!search.Brand.HasValue || p.BrandId == search.Brand.Value) &&
(!search.FromDate.HasValue || p.CreateDate >= search.FromDate.Value) &&
(!search.ToDate.HasValue || p.CreateDate <= search.ToDate.Value) &&
p.Status != (int)DataStatus.Deleted);
linq = _userAuthRepo.AuthFilter(linq, search.CurrentUser, search.CurrentUserRole) as IQueryable<OrderEntity>;
var linq2 = linq.Join(dbContext.Set<UserEntity>().Where(u => u.Status != (int)DataStatus.Deleted),
o => o.CustomerId,
i => i.Id,
(o, i) => new { O = o, C = i })
.GroupJoin(dbContext.Set<RMAEntity>(),
o => o.O.OrderNo,
i => i.OrderNo,
(o, i) => new { O = o.O, C = o.C, RMA = i })
.GroupJoin(dbContext.Set<ShipViaEntity>().Where(s => s.Status != (int)DataStatus.Deleted),
o => o.O.ShippingVia,
i => i.Id,
(o, i) => new { O = o.O, C = o.C, RMA = o.RMA, S = i.FirstOrDefault() });
totalCount = linq2.Count();
var skipCount = (request.PageIndex - 1) * request.PageSize;
var linq3 = skipCount == 0 ? linq2.OrderByDescending(l => l.O.CreateDate).Take(request.PageSize) : linq2.OrderByDescending(l => l.O.CreateDate).Skip(skipCount).Take(request.PageSize);
var vo = from l in linq3.ToList()
select new OrderViewModel().FromEntity<OrderViewModel>(l.O, p =>
{
p.ShippingViaMethod = l.S;
p.Customer = new CustomerViewModel().FromEntity<CustomerViewModel>(l.C);
p.ShippingViaMethod_Name = l.S==null?string.Empty:l.S.Name;
p.RMAs = l.RMA.ToList().OrderByDescending(r=>r.CreateDate).Select(r => new RMAViewModel().FromEntity<RMAViewModel>(r));
});
var v = new Pager<OrderViewModel>(request, totalCount) { Data = vo.ToList() };
return Json(v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:52,代码来源:OrderController.cs
示例16: List
public ActionResult List(PagerRequest request,ProductPropertyValueSearchOption search)
{
int totalCount;
var prodLinq = _userauthRepo.AuthFilter(_prodRepo.GetAll(), CurrentUser.CustomerId, CurrentUser.Role) as IQueryable<ProductEntity>;
var linq = _prodpropertyvalRepo.Get(pv => pv.Status != (int)DataStatus.Deleted)
.Join(_prodpropertyRepo.Get(p => p.Status != (int)DataStatus.Deleted), o => o.PropertyId, i => i.Id, (o, i) => new { PV = o, P = i })
.Join(prodLinq, o => o.P.ProductId, i => i.Id, (o, i) => new { PV = o.PV, P = o.P, T = i })
.Where(l => (string.IsNullOrEmpty(search.PropertyDesc) || l.P.PropertyDesc.StartsWith(search.PropertyDesc)) &&
(string.IsNullOrEmpty(search.ValueDesc) || l.PV.ValueDesc.StartsWith(search.ValueDesc)) &&
(!search.ProductId.HasValue || l.P.ProductId == search.ProductId.Value));
linq = linq.WhereWithPageSort(
out totalCount
, request.PageIndex
, request.PageSize
, e =>
{
return e.OrderByDescending(l => l.P.ProductId).ThenByDescending(l => l.P.UpdateDate);
});
var vo = new List<ProductPropertyViewModel>();
foreach (var l in linq)
{
var existProperty = vo.Find(t => t.ProductId == l.P.ProductId);
var newValue = new TagPropertyValueViewModel().FromEntity<TagPropertyValueViewModel>(l.PV, p =>
{
p.PropertyDesc = l.P.PropertyDesc;
p.SortOrder = l.P.SortOrder??0;
p.PropertyId = l.P.Id;
p.ValueId = l.PV.Id;
});
if (existProperty != null)
{
existProperty.Values.Add(newValue);
} else
{
vo.Add(new ProductPropertyViewModel().FromEntity<ProductPropertyViewModel>(l.P, p =>
{
p.ProductName = l.T.Name;
p.Values = new List<TagPropertyValueViewModel>();
p.Values.Add(newValue);
}));
}
}
var v = new Pager<ProductPropertyViewModel>(request, totalCount) { Data =vo };
return View("List", v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:51,代码来源:ProductPropertyValueController.cs
示例17: List
public ActionResult List(PagerRequest request, BannerSearchOption search)
{
int totalCount;
var linq = _bannerRepo.Get(e => (!search.PromotionId.HasValue || (e.SourceId == search.PromotionId.Value && e.SourceType == (int)SourceType.Promotion))
&& (!search.Status.HasValue || e.Status == (int)search.Status.Value)
&& e.Status != (int)DataStatus.Deleted
, out totalCount
, request.PageIndex
, request.PageSize
, e =>
{
if (!search.OrderBy.HasValue)
return e.OrderByDescending(o => o.CreatedDate);
else
{
switch (search.OrderBy.Value)
{
case GenericOrder.OrderByCreateUser:
return e.OrderByDescending(o => o.CreatedUser);
case GenericOrder.OrderByCreateDate:
default:
return e.OrderByDescending(o => o.CreatedDate);
}
}
});
var linq_All = linq.Join(_proRepo.GetAll(),
o => o.SourceId,
i => i.Id,
(o, i) => new { B = o, P = i })
.GroupJoin(_resourceRepo.Get(r => r.SourceType == (int)SourceType.BannerPromotion),
o => o.B.Id,
i => i.SourceId,
(o, i) => new { B = o.B, P = o.P, R = i.FirstOrDefault() });
var vo = from l in linq_All.ToList()
select new BannerViewModel() {
Id = l.B.Id,
SourceId = l.B.SourceId,
SourceType = l.B.SourceType,
Resource = MappingManager.ResourceViewMapping(l.R),
Promotion = MappingManager.PromotionViewMapping(l.P),
SortOrder = l.B.SortOrder,
Status = l.B.Status
};
var v = new BannerCollectionViewModel(request, totalCount) { Banners = vo.ToList() };
ViewBag.SearchOptions = search;
return View("List", v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:50,代码来源:BannerController.cs
示例18: List
public ActionResult List(PagerRequest request, UserAuthSearchOption search)
{
int totalCount;
var data = _authRepo.Get(e => (!search.Type.HasValue || e.Type == search.Type.Value)
&& (!search.BrandId.HasValue || e.BrandId == search.BrandId.Value)
&& (!search.StoreId.HasValue || e.StoreId == search.StoreId.Value)
&& (!search.UserId.HasValue || e.UserId == search.UserId.Value)
&& e.Status != (int)DataStatus.Deleted
, out totalCount
, request.PageIndex
, request.PageSize
, e =>
{
if (!search.OrderBy.HasValue)
return e.OrderByDescending(o => o.CreatedDate);
else
{
switch (search.OrderBy.Value)
{
case GenericOrder.OrderByCreateUser:
return e.OrderByDescending(o => o.CreatedUser);
case GenericOrder.OrderByName:
case GenericOrder.OrderByCreateDate:
default:
return e.OrderByDescending(o => o.CreatedDate);
}
}
});
var models = data.Join(_customerRepo.GetAll(),o=>o.UserId,i=>i.Id,(o,i)=>new {UA=o,U=i})
.GroupJoin(_storeRepo.GetAll(),o=>o.UA.StoreId,i=>i.Id,(o,i)=>new {UA=o.UA,U=o.U,S=i.FirstOrDefault()})
.GroupJoin(_brandRep.GetAll(),o=>o.UA.BrandId,i=>i.Id,(o,i)=>new {UA=o.UA,U=o.U,S=o.S,B=i.FirstOrDefault()})
.ToList()
.Select(o=>new UserAuthViewModel(){
Id = o.UA.Id
, BrandId = o.UA.BrandId
, StoreId = o.UA.StoreId
, Type = o.UA.Type
, BrandName = o.B==null?"所有":o.B.Name
, UserId = o.UA.UserId
,UserNick = o.U.Nickname
, StoreName = o.S == null ? "所有" : o.S.Name
,Status = o.UA.Status.Value
});
return View("List", new Pager<UserAuthViewModel>(request, totalCount) { Data=models.ToList()});
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:50,代码来源:UserAuthController.cs
示例19: List
public ActionResult List(PagerRequest request,PromotionListSearchOption search)
{
int totalCount;
var storeList = new List<int>();
if (!string.IsNullOrEmpty(search.Store))
storeList = _storeRepository.Get(s => s.Name.StartsWith(search.Store)).Select(s=>s.Id).ToList();
var linq= _promotionRepository.Get(e => (!search.PId.HasValue || e.Id== search.PId.Value)
&& (string.IsNullOrEmpty(search.Name) || e.Name.ToLower().StartsWith(search.Name.ToLower()))
&& (!search.Status.HasValue || e.Status == (int)search.Status.Value)
&& e.Status != (int)DataStatus.Deleted
&& (string.IsNullOrEmpty(search.Store) || storeList.Any(m=>m==e.Store_Id)));
linq = _authRepo.AuthFilter(linq, CurrentUser.CustomerId, CurrentUser.Role) as IQueryable<PromotionEntity>;
Func<IQueryable<PromotionEntity>, IOrderedQueryable<PromotionEntity>> orderBy = (IQueryable<PromotionEntity> e) =>
{
if (!search.OrderBy.HasValue)
{
return e.OrderByDescending(o => o.CreatedDate);
}
else
{
switch (search.OrderBy.Value)
{
case GenericOrder.OrderByCreateUser:
return e.OrderByDescending(o => o.CreatedUser);
case GenericOrder.OrderByName:
return e.OrderByDescending(o => o.Name);
case GenericOrder.OrderByCreateDate:
default:
return e.OrderByDescending(o => o.CreatedDate);
}
}
};
linq = orderBy(linq);
totalCount = linq.Count();
var skipCount = (request.PageIndex - 1) * request.PageSize;
linq = skipCount == 0 ? linq.Take(request.PageSize) : linq.Skip(skipCount).Take(request.PageSize);
var vo = MappingManager.PromotionViewMapping(linq.ToList());
var v = new PromotionCollectionViewModel(request, totalCount) { Promotions = vo.ToList() };
ViewBag.SearchOptions = search;
return View("List", v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:49,代码来源:PromotionController.cs
示例20: List
public ActionResult List(PagerRequest request,TagPropertyValueSearchOption search)
{
int totalCount;
var linq = _tagpropertyvalueRepo.Get(pv => pv.Status != (int)DataStatus.Deleted)
.Join(_tagpropertyRepo.Get(p => p.Status != (int)DataStatus.Deleted), o => o.PropertyId, i => i.Id, (o, i) => new { PV = o, P = i })
.Join(_tagRepo.GetAll(), o => o.P.CategoryId, i => i.Id, (o, i) => new { PV = o.PV, P = o.P, T = i })
.Where(l => (!search.PId.HasValue || l.PV.Id == search.PId.Value) &&
(string.IsNullOrEmpty(search.PropertyDesc) || l.P.PropertyDesc.StartsWith(search.PropertyDesc)) &&
(string.IsNullOrEmpty(search.ValueDesc) || l.PV.ValueDesc.StartsWith(search.ValueDesc)) &&
(!search.CategoryId.HasValue || l.P.CategoryId == search.CategoryId.Value));
linq = linq.WhereWithPageSort(
out totalCount
, request.PageIndex
, request.PageSize
, e =>
{
return e.OrderByDescending(l => l.P.CategoryId).ThenByDescending(l => l.P.CreatedDate);
});
var vo = new List<TagPropertyViewModel>();
foreach (var l in linq)
{
var existProperty = vo.Find(t=>t.CategoryId == l.P.CategoryId);
var newValue = new TagPropertyValueViewModel().FromEntity<TagPropertyValueViewModel>(l.PV,p=>{
p.PropertyDesc = l.P.PropertyDesc;
p.SortOrder = l.P.SortOrder;
p.PropertyId = l.P.Id;
p.ValueId = l.PV.Id;
});
if (existProperty != null)
{
existProperty.Values.Add(newValue);
} else
{
vo.Add(new TagPropertyViewModel().FromEntity<TagPropertyViewModel>(l.P,p=>{
p.CategoryName = l.T.Name;
p.Values = new List<TagPropertyValueViewModel>();
p.Values.Add(newValue);
}));
}
}
var v = new Pager<TagPropertyViewModel>(request, totalCount) { Data =vo };
return View("List", v);
}
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:49,代码来源:PropertyValueController.cs
注:本文中的PagerRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论