예제 #1
0
        public async Task <PagedQueryResult <CustomEntityRenderSummary> > ExecuteAsync(SearchCustomEntityRenderSummariesQuery query, IExecutionContext executionContext)
        {
            var dbPagedResult = await GetQueryAsync(query, executionContext);

            var results = await _customEntityRenderSummaryMapper.MapAsync(dbPagedResult.Items, executionContext);

            return(dbPagedResult.ChangeType(results));
        }
예제 #2
0
        public async Task <ICollection <CustomEntityRenderSummary> > ExecuteAsync(GetCustomEntityRenderSummariesByDefinitionCodeQuery query, IExecutionContext executionContext)
        {
            var dbResults = await QueryAsync(query, executionContext);

            var results = await _customEntityRenderSummaryMapper.MapAsync(dbResults, executionContext);

            return(results);
        }
예제 #3
0
        public async Task <IDictionary <int, CustomEntityRenderSummary> > ExecuteAsync(GetCustomEntityRenderSummariesByIdRangeQuery query, IExecutionContext executionContext)
        {
            var dbResults = await QueryAsync(query, executionContext);

            EnforcePermissions(dbResults, executionContext);
            var results = await _customEntityRenderSummaryMapper.MapAsync(dbResults, executionContext);

            return(results.ToDictionary(r => r.CustomEntityId));
        }
예제 #4
0
        public async Task <CustomEntityRenderSummary> ExecuteAsync(GetCustomEntityRenderSummaryByIdQuery query, IExecutionContext executionContext)
        {
            var dbResult = await QueryAsync(query, executionContext);

            if (dbResult == null)
            {
                return(null);
            }

            await _permissionValidationService.EnforceCustomEntityPermissionAsync <CustomEntityReadPermission>(dbResult.CustomEntity.CustomEntityDefinitionCode);

            var result = await _customEntityRenderSummaryMapper.MapAsync(dbResult, executionContext);

            return(result);
        }
예제 #5
0
        public async Task <ICollection <CustomEntityRenderSummary> > ExecuteAsync(GetCustomEntityRenderSummariesByUrlSlugQuery query, IExecutionContext executionContext)
        {
            var dbResult = await _dbContext
                           .CustomEntityPublishStatusQueries
                           .AsNoTracking()
                           .FilterActive()
                           .FilterByCustomEntityDefinitionCode(query.CustomEntityDefinitionCode)
                           .FilterByCustomEntityUrlSlug(query.UrlSlug)
                           .FilterByStatus(query.PublishStatus, executionContext.ExecutionDate)
                           .Select(e => e.CustomEntityVersion)
                           .Include(e => e.CustomEntity)
                           .ToListAsync();

            if (!dbResult.Any())
            {
                return(Array.Empty <CustomEntityRenderSummary>());
            }

            var result = await _customEntityRenderSummaryMapper.MapAsync(dbResult, executionContext);

            return(result);
        }