Ejemplo n.º 1
0
        private void LoadContents(bool includeHtml, bool includeTechnicalInfo, bool includeChildContentsOptions,
                                  Guid blogPostId, GetBlogPostPropertiesResponse response)
        {
            var content =
                repository.AsQueryable <Module.Root.Models.PageContent>(pc => pc.Page.Id == blogPostId && !pc.Content.IsDeleted && pc.Content is BlogPostContent)
                .Select(pc => new
            {
                Html            = ((BlogPostContent)pc.Content).Html,
                OriginalText    = ((BlogPostContent)pc.Content).OriginalText,
                ContentTextMode = ((BlogPostContent)pc.Content).ContentTextMode,
                ContentId       = pc.Content.Id,
                PageContentId   = pc.Id,
                RegionId        = pc.Region.Id
            })
                .FirstOrDefault();

            if (content != null)
            {
                if (includeHtml)
                {
                    response.HtmlContent     = content.Html;
                    response.OriginalText    = content.OriginalText;
                    response.ContentTextMode = (ContentTextMode)content.ContentTextMode;
                }

                if (includeTechnicalInfo)
                {
                    response.TechnicalInfo = new TechnicalInfoModel
                    {
                        BlogPostContentId = content.ContentId,
                        PageContentId     = content.PageContentId,
                        RegionId          = content.RegionId
                    };
                }

                if (includeChildContentsOptions)
                {
                    response.ChildContentsOptionValues = optionService
                                                         .GetChildContentsOptionValues(content.ContentId)
                                                         .ToServiceModel();
                }
            }
        }