public EntityEditorViewModel Build(TEntity value) { var definition = entityDefinitionFactory.CreateFor <TEntity>(); var metadata = definition.Using <CrudAdminEntityFeature>(); return(new EntityEditorViewModel(definition) { DataSourceUrl = metadata.DataSourceUrl, DisplayName = definition.DisplayName, Fields = BuildFieldsViewModel(definition, value).ToList(), }); }
public async Task <ListViewModel> Build(CrudSearchResult <TEntity> result, int page, int pageSize) { var definition = entityDefinitionFactory.CreateFor <TEntity>(); return(new ListViewModel { DisplayName = definition.DisplayName, Columns = CreateListViewColumnFromType(definition), PageCount = ((result.Count - 1) / pageSize) + 1, CurrentPage = page, Results = await result.Results.Select(e => e.ToDictionary()).ToListAsync(), }); }