예제 #1
0
        /// <summary>
        /// Maps the basic properties on a PageRenderDetails.
        /// </summary>
        /// <remarks>
        /// This isn't a very fully featured map function and will likey
        /// be reworked later on.
        /// </remarks>
        public PageRenderDetails Map(
            PageVersion dbPageVersion
            )
        {
            var page = new PageRenderDetails()
            {
                MetaDescription = dbPageVersion.MetaDescription,
                PageId          = dbPageVersion.PageId,
                PageVersionId   = dbPageVersion.PageVersionId,
                Title           = dbPageVersion.Title,
                WorkFlowStatus  = (WorkFlowStatus)dbPageVersion.WorkFlowStatusId
            };

            page.OpenGraph = _openGraphDataMapper.Map(dbPageVersion);
            page.Template  = _pageTemplateMapper.Map(dbPageVersion.PageTemplate);

            page.Regions = dbPageVersion
                           .PageTemplate
                           .PageTemplateRegions
                           .Select(r => new PageRegionRenderDetails()
            {
                PageTemplateRegionId = r.PageTemplateRegionId,
                Name = r.Name
                       // Blocks mapped elsewhere
            })
                           .ToList();

            return(page);
        }
예제 #2
0
        private PageDetails Map(
            PageVersion dbPageVersion,
            ICollection <PageRegionDetails> regions,
            PageRoute pageRoute
            )
        {
            var page = new PageDetails();

            page.PageId    = dbPageVersion.PageId;
            page.PageRoute = pageRoute;
            page.AuditData = _auditDataMapper.MapCreateAuditData(dbPageVersion.Page);
            page.Tags      = dbPageVersion
                             .Page
                             .PageTags
                             .Select(t => t.Tag.TagText)
                             .OrderBy(t => t)
                             .ToList();

            page.LatestVersion = new PageVersionDetails()
            {
                MetaDescription = dbPageVersion.MetaDescription,
                PageVersionId   = dbPageVersion.PageVersionId,
                ShowInSiteMap   = !dbPageVersion.ExcludeFromSitemap,
                Title           = dbPageVersion.Title,
                WorkFlowStatus  = (WorkFlowStatus)dbPageVersion.WorkFlowStatusId
            };

            page.LatestVersion.OpenGraph = _openGraphDataMapper.Map(dbPageVersion);
            page.LatestVersion.Template  = _pageTemplateMapper.Map(dbPageVersion.PageTemplate);
            page.LatestVersion.Regions   = regions;

            return(page);
        }
예제 #3
0
        private T MapInternal <T>(PageVersion dbPageVersion) where T : PageRenderSummary, new()
        {
            var page = new T()
            {
                MetaDescription = dbPageVersion.MetaDescription,
                PageId          = dbPageVersion.PageId,
                PageVersionId   = dbPageVersion.PageVersionId,
                Title           = dbPageVersion.Title,
                WorkFlowStatus  = (WorkFlowStatus)dbPageVersion.WorkFlowStatusId,
                CreateDate      = dbPageVersion.CreateDate
            };

            page.OpenGraph = _openGraphDataMapper.Map(dbPageVersion);
            return(page);
        }