Exemplo n.º 1
0
        public async Task <PageTemplateDetails> ExecuteAsync(GetPageTemplateDetailsByIdQuery query, IExecutionContext executionContext)
        {
            var queryModel = new PageTemplateDetailsQueryModel();

            queryModel.PageTemplate = await _dbContext
                                      .PageTemplates
                                      .AsNoTracking()
                                      .Include(t => t.PageTemplateRegions)
                                      .Where(l => l.PageTemplateId == query.PageTemplateId)
                                      .SingleOrDefaultAsync();

            if (queryModel.PageTemplate == null)
            {
                return(null);
            }

            if (!string.IsNullOrEmpty(queryModel.PageTemplate.CustomEntityDefinitionCode))
            {
                var definitionQuery = new GetCustomEntityDefinitionMicroSummaryByCodeQuery(queryModel.PageTemplate.CustomEntityDefinitionCode);
                queryModel.CustomEntityDefinition = await _queryExecutor.ExecuteAsync(definitionQuery, executionContext);
            }

            queryModel.NumPages = await _dbContext
                                  .PageVersions
                                  .AsNoTracking()
                                  .Where(v => v.PageTemplateId == query.PageTemplateId)
                                  .GroupBy(v => v.PageId)
                                  .CountAsync();

            var template = _pageTemplateDetailsMapper.Map(queryModel);

            return(template);
        }
Exemplo n.º 2
0
        public Task <CustomEntityDefinitionMicroSummary> GetCustomEntityDefinitionMicroSummaryByCodeAsync(string customEntityDefinitionCode, IExecutionContext executionContext = null)
        {
            var query = new GetCustomEntityDefinitionMicroSummaryByCodeQuery(customEntityDefinitionCode);

            return(_queryExecutor.ExecuteAsync(query, executionContext));
        }
        public IContentRepositoryQueryContext <CustomEntityDefinitionMicroSummary> AsMicroSummary()
        {
            var query = new GetCustomEntityDefinitionMicroSummaryByCodeQuery(_customEntityDefinitionCode);

            return(ContentRepositoryQueryContextFactory.Create(query, ExtendableContentRepository));
        }
        public Task <CustomEntityDefinitionMicroSummary> AsMicroSummaryAsync()
        {
            var query = new GetCustomEntityDefinitionMicroSummaryByCodeQuery(_customEntityDefinitionCode);

            return(ExtendableContentRepository.ExecuteQueryAsync(query));
        }