Esempio n. 1
0
        protected async Task <IndexViewModel <TCustomViewModel> > GetIndexViewModelAsync <TCustomViewModel>(int page, int totalPages, int totalCount, IEnumerable <TEntity> entities)
            where TCustomViewModel : TViewModel
        {
            var viewModels = new List <TCustomViewModel>();

            foreach (var entity in entities)
            {
                viewModels.Add(await GetViewModelAsync <TCustomViewModel>(entity));
            }
            return(IndexViewModel <TCustomViewModel> .FromEnumerable(page, totalPages, totalCount, viewModels));

            //var types = new Type[] { typeof(int), typeof(int), typeof(int), typeof(IEnumerable<TEntity>) };
            //return (TCustomIndexViewModel)ast.GetActivator(typeof(TCustomIndexViewModel), types)(page, totalPages, totalCount, entities);
        }