public async Task <List <TViewModel> > GetBoVMCollectionAsyn(ListSinglePageParameter listPageParameter, Expression <Func <TEntity, bool> > navigatorPredicate, params Expression <Func <TEntity, object> >[] includeProperties) { var boCollection = await _entityRepository.GetBoCollectionAsyn(listPageParameter, navigatorPredicate, includeProperties); var boVMCollection = new List <TViewModel>(); int count = 0; foreach (var item in boCollection) { var boVM = new TViewModel(); item.MapToViewModel <TEntity, TViewModel>(boVM); boVM.OrderNumber = (++count).ToString(); boVMCollection.Add(boVM); } return(boVMCollection); }
public async Task <List <TViewModel> > GetBoVMCollectionAsyn(ListSinglePageParameter listPageParameter) { var boCollection = await _entityRepository.GetBoCollectionAsyn(listPageParameter); var boVMCollection = new List <TViewModel>(); int count = 0; foreach (var item in boCollection) { var boVM = new TViewModel(); item.MapToViewModel <TEntity, TViewModel>(boVM); boVM.OrderNumber = (++count).ToString(); boVMCollection.Add(boVM); } return(boVMCollection); }
public async Task <List <TViewModel> > GetBoVMCollectionWithHierarchicalStyleAsyn(ListSinglePageParameter listPageParameter, Expression <Func <TEntity, bool> > navigatorPredicate, Expression <Func <TEntity, object> > includeProperty) { var boCollection = await _entityRepository.GetBoCollectionAsyn(listPageParameter, navigatorPredicate, includeProperty); var selfReferentialItemCollection = SelfReferentialItemFactory <TEntity> .GetCollection(boCollection.ToList(), true); var boVMCollection = new List <TViewModel>(); int count = 0; foreach (var item in boCollection.OrderBy(x => x.SortCode)) { var boVM = new TViewModel(); item.MapToViewModel <TEntity, TViewModel>(boVM); boVM.OrderNumber = (++count).ToString(); var sItem = selfReferentialItemCollection.FirstOrDefault(x => x.ID == item.ID.ToString()); if (sItem != null) { boVM.Name = sItem.DisplayName; } boVMCollection.Add(boVM); } return(boVMCollection); }