public async Task <PageRenderDetails> ExecuteAsync(GetPageRenderDetailsByIdQuery query, IExecutionContext executionContext) { var page = await GetPage(query); if (page == null) { return(null); } var dbModules = await _dbContext .PageVersionModules .AsNoTracking() .Where(m => m.PageVersionId == page.PageVersionId) .ToListAsync(); await _entityVersionPageModuleMapper.MapSectionsAsync(dbModules, page.Sections, query.WorkFlowStatus, executionContext); return(page); }
public async Task <CustomEntityRenderDetails> ExecuteAsync(GetCustomEntityRenderDetailsByIdQuery query, IExecutionContext executionContext) { var dbQuery = _dbContext .CustomEntityVersions .AsNoTracking() .FilterByCustomEntityId(query.CustomEntityId) .FilterByWorkFlowStatusQuery(query.WorkFlowStatus, query.CustomEntityVersionId) .Include(e => e.CustomEntity) .Include(e => e.CustomEntity.Locale); var dbResult = await dbQuery.FirstOrDefaultAsync(); _permissionValidationService.EnforceCustomEntityPermission <CustomEntityReadPermission>(dbResult.CustomEntity.CustomEntityDefinitionCode); var entity = Mapper.Map <CustomEntityRenderDetails>(dbResult); entity.Model = _customEntityDataModelMapper.Map(dbResult.CustomEntity.CustomEntityDefinitionCode, dbResult.SerializedData); entity.Sections = await _dbContext .PageTemplateSections .AsNoTracking() .Where(s => s.PageTemplateId == query.PageTemplateId) .ProjectTo <CustomEntityPageSectionRenderDetails>() .ToListAsync(); var dbModules = await _dbContext .CustomEntityVersionPageModules .AsNoTracking() .Where(m => m.CustomEntityVersionId == entity.CustomEntityVersionId) .ToListAsync(); await _entityVersionPageModuleMapper.MapSectionsAsync <CustomEntityVersionPageModuleRenderDetails>(dbModules, entity.Sections, query.WorkFlowStatus, executionContext); var routingQuery = new GetPageRoutingInfoByCustomEntityIdQuery(dbResult.CustomEntityId); var routing = await _queryExecutor.ExecuteAsync(routingQuery, executionContext); entity.DetailsPageUrls = MapPageRoutings(routing, dbResult); return(entity); }