Example #1
0
        public IDictionary <int, PageRenderDetails> Execute(GetPageRenderDetailsByIdRangeQuery query, IExecutionContext executionContext)
        {
            var dbPages = QueryPages(query).ToList();
            var pages   = Mapper.Map <List <PageRenderDetails> >(dbPages);

            var pageRoutes = _queryExecutor.GetByIdRange <PageRoute>(GetAllPageIds(pages), executionContext);

            MapPageRoutes(pages, pageRoutes);

            var dbModules      = QueryModules(pages).ToList();
            var allModuleTypes = _queryExecutor.GetAll <PageModuleTypeSummary>(executionContext);

            _entityVersionPageModuleMapper.MapSections(dbModules, pages.SelectMany(p => p.Sections), allModuleTypes, query.WorkFlowStatus);

            return(pages.ToDictionary(d => d.PageId));
        }
        public PageRenderDetails Execute(GetPageRenderDetailsByIdQuery query, IExecutionContext executionContext)
        {
            var dbPage = QueryPage(query).FirstOrDefault();

            if (dbPage == null)
            {
                return(null);
            }
            var page = Mapper.Map <PageRenderDetails>(dbPage);

            page.PageRoute = _queryExecutor.GetById <PageRoute>(page.PageId, executionContext);

            var dbModules      = QueryModules(page).ToList();
            var allModuleTypes = _queryExecutor.GetAll <PageModuleTypeSummary>(executionContext);

            _entityVersionPageModuleMapper.MapSections(dbModules, page.Sections, allModuleTypes, query.WorkFlowStatus);

            return(page);
        }
        public CustomEntityRenderDetails Execute(GetCustomEntityRenderDetailsByIdQuery query, IExecutionContext executionContext)
        {
            var dbResult = QueryCustomEntity(query).FirstOrDefault();
            var entity   = MapCustomEntity(dbResult);

            entity.Sections = QuerySections(query).ToList();
            var dbModules = QueryModules(entity).ToList();

            var allModuleTypes = _queryExecutor.GetAll <PageModuleTypeSummary>(executionContext);

            _entityVersionPageModuleMapper.MapSections(dbModules, entity.Sections, allModuleTypes, query.WorkFlowStatus);

            var routingQuery = new GetPageRoutingInfoByCustomEntityIdQuery(dbResult.CustomEntityId);
            var routing      = _queryExecutor.Execute(routingQuery, executionContext);

            entity.DetailsPageUrls = MapPageRoutings(routing, dbResult);

            return(entity);
        }