Esempio n. 1
0
 private IQueryable <PageVersionBlock> QueryPageBlocks(GetPageRegionDetailsByPageVersionIdQuery query)
 {
     return(_dbContext
            .PageVersionBlocks
            .AsNoTracking()
            .Where(m => m.PageVersionId == query.PageVersionId));
 }
Esempio n. 2
0
        public async Task <ICollection <PageRegionDetails> > ExecuteAsync(GetPageRegionDetailsByPageVersionIdQuery query, IExecutionContext executionContext)
        {
            var regions = await GetRegions(query).ToListAsync();

            var dbPageBlocks = await QueryPageBlocks(query).ToListAsync();

            var allBlockTypes = await _queryExecutor.ExecuteAsync(new GetAllPageBlockTypeSummariesQuery(), executionContext);

            MapRegions(regions, dbPageBlocks, allBlockTypes);

            return(regions);
        }
Esempio n. 3
0
        private IQueryable <PageRegionDetails> GetRegions(GetPageRegionDetailsByPageVersionIdQuery query)
        {
            var dbQuery = _dbContext
                          .PageVersions
                          .AsNoTracking()
                          .FilterActive()
                          .FilterByPageVersionId(query.PageVersionId)
                          .SelectMany(v => v.PageTemplate.PageTemplateRegions)
                          .Where(s => !s.IsCustomEntityRegion)
                          .OrderBy(s => s.UpdateDate)
                          .Select(s => new PageRegionDetails()
            {
                PageTemplateRegionId = s.PageTemplateRegionId,
                Name = s.Name
            });

            return(dbQuery);
        }
Esempio n. 4
0
        private GetPageRegionDetailsByPageVersionIdQuery GetRegionsQuery(PageVersion page)
        {
            var regionsQuery = new GetPageRegionDetailsByPageVersionIdQuery(page.PageVersionId);

            return(regionsQuery);
        }
Esempio n. 5
0
        /// <summary>
        /// Returns a collection of the content managed regions and
        /// blocks for a specific version of a page.
        /// </summary>
        /// <param name="pageVersionId">Database id of the page version to get content data for.</param>
        /// <param name="executionContext">Optional execution context to use when executing the query. Useful if you need to temporarily elevate your permission level.</param>
        public Task <ICollection <PageRegionDetails> > GetPageRegionDetailsByPageVersionIdAsync(int pageVersionId, IExecutionContext executionContext = null)
        {
            var query = new GetPageRegionDetailsByPageVersionIdQuery(pageVersionId);

            return(_queryExecutor.ExecuteAsync(query, executionContext));
        }
Esempio n. 6
0
 public IEnumerable <IPermissionApplication> GetPermissions(GetPageRegionDetailsByPageVersionIdQuery query)
 {
     yield return(new PageReadPermission());
 }
Esempio n. 7
0
        public IContentRepositoryQueryContext <ICollection <PageRegionDetails> > AsDetails()
        {
            var query = new GetPageRegionDetailsByPageVersionIdQuery(_pageVersionId);

            return(ContentRepositoryQueryContextFactory.Create(query, ExtendableContentRepository));
        }
Esempio n. 8
0
        public Task <ICollection <PageRegionDetails> > AsDetailsAsync()
        {
            var query = new GetPageRegionDetailsByPageVersionIdQuery(_pageVersionId);

            return(ExtendableContentRepository.ExecuteQueryAsync(query));
        }