Exemple #1
0
        protected override IEnumerable <Navigation> GetDynamicNavigations(string presentAreaKey, long ownerId = 0)
        {
            List <Navigation> navigations = new List <Navigation>();

            if (presentAreaKey != PresentAreaKeysOfBuiltIn.Channel)
            {
                return(navigations);
            }

            ContentFolderService        contentFolderService = new ContentFolderService();
            IEnumerable <ContentFolder> contentFolders       = contentFolderService.GetRootFolders();

            if (contentFolders != null)
            {
                foreach (var contentFolder in contentFolders)
                {
                    if (!contentFolder.IsEnabled)
                    {
                        continue;
                    }
                    string url = SiteUrls.Instance().FolderDetail(contentFolder.ContentFolderId);
                    if (contentFolder.IsLink)
                    {
                        url = contentFolder.LinkUrl;
                    }

                    int        navigationId = NavigationService.GenerateDynamicNavigationId(contentFolder.ContentFolderId);
                    Navigation navigation   = new Navigation()
                    {
                        ApplicationId      = ApplicationId,
                        Depth              = 1,
                        NavigationId       = navigationId,
                        NavigationText     = contentFolder.FolderName,
                        ParentNavigationId = 10101501,
                        IsEnabled          = true,
                        NavigationTarget   = "_self",
                        NavigationUrl      = url,
                        PresentAreaKey     = PresentAreaKeysOfBuiltIn.Channel,
                        DisplayOrder       = (int)contentFolder.DisplayOrder + 90000000
                    };
                    if (contentFolder.IsLink && contentFolder.IsLinkToNewWindow)
                    {
                        navigation.NavigationTarget = "_blank";
                    }
                    navigations.Add(navigation);
                }
            }

            return(navigations);
        }
Exemple #2
0
        /// <summary>
        /// 批量移动ContentItem
        /// </summary>
        /// <param name="contentItemIds"></param>
        /// <param name="toContentFolderId"></param>
        public void Move(IEnumerable <long> contentItemIds, int toContentFolderId)
        {
            ContentFolderService contentFolderService = new ContentFolderService();

            ContentFolder toContentFolder = contentFolderService.Get(toContentFolderId);

            if (toContentFolder == null)
            {
                return;
            }

            contentItemIds = contentItemIds.Distinct();
            IEnumerable <ContentItem> contentItemsForMove = contentItemRepository.PopulateEntitiesByEntityIds(contentItemIds).Where(c => c.ContentFolderId != toContentFolderId);

            contentItemRepository.Move(contentItemsForMove, toContentFolderId);
            foreach (var contentItem in contentItemsForMove)
            {
                //执行事件
                EventBus <ContentItem> .Instance().OnAfter(contentItem, new CommonEventArgs(EventOperationType.Instance().Update(), ApplicationIds.Instance().CMS()));
            }
        }
Exemple #3
0
        public ContentFolder AsContentFolder()
        {
            ContentFolder contentFolder = new ContentFolder();

            if (this.ContentFolderId > 0)
            {
                contentFolder = new ContentFolderService().Get(this.ContentFolderId);
            }

            contentFolder.FolderName = this.FolderName;

            contentFolder.Description = this.Description ?? string.Empty;

            contentFolder.IsEnabled = this.IsEnabled;

            contentFolder.IsAsNavigation = this.IsAsNavigation;

            contentFolder.ParentId = this.ParentId.HasValue ? this.ParentId.Value : 0;

            contentFolder.Page_Detail = this.Page_Detail ?? string.Empty;

            contentFolder.Page_List = this.Page_List ?? string.Empty;

            contentFolder.IsLinkToNewWindow = this.IsLinkToNewWindow;

            contentFolder.LinkUrl = this.LinkUrl ?? string.Empty;

            contentFolder.IsLink = this.IsLink;

            contentFolder.ContentTypeKeys = string.Join(",", this.ContentTypeKeys);

            contentFolder.Icon = this.icon ?? string.Empty;

            contentFolder.METATitle       = this.METATitle ?? string.Empty;
            contentFolder.METAKeywords    = this.METAKeywords ?? string.Empty;
            contentFolder.METADescription = this.METADescription ?? string.Empty;
            contentFolder.NeedAuditing    = this.NeedAuditing;
            contentFolder.Editor          = this.Editor ?? string.Empty;
            return(contentFolder);
        }
        /// <summary>
        /// 获取前topNumber条ContentItem
        /// </summary>
        public IEnumerable <ContentItem> GetTops(int topNumber, int?contentFolderId, ContentItemSortBy sortBy)
        {
            return(GetTopEntities(topNumber, CachingExpirationType.UsualObjectCollection,
                                  () =>
            {
                StringBuilder cacheKey;
                if (contentFolderId.HasValue)
                {
                    cacheKey = new StringBuilder(RealTimeCacheHelper.GetListCacheKeyPrefix(CacheVersionType.AreaVersion, "ContentFolderId", contentFolderId));
                }
                else
                {
                    cacheKey = new StringBuilder(RealTimeCacheHelper.GetListCacheKeyPrefix(CacheVersionType.GlobalVersion));
                }

                cacheKey.AppendFormat("ContentFolderId-{0}:SortBy-{1}", contentFolderId.ToString(), (int)sortBy);
                return cacheKey.ToString();
            },
                                  () =>
            {
                var sql = Sql.Builder.Select("spb_cms_ContentItems.*").From("spb_cms_ContentItems");
                var whereSql = Sql.Builder;
                var orderSql = Sql.Builder;

                if (contentFolderId.HasValue && contentFolderId.Value > 0)
                {
                    ContentFolderService contentFolderService = new ContentFolderService();
                    IEnumerable <ContentFolder> contentFolders = contentFolderService.GetDescendants(contentFolderId.Value);
                    IEnumerable <int> descendantFolderIds = contentFolders == null ? new List <int>() : contentFolders.Select(f => f.ContentFolderId);
                    List <int> folderIds = new List <int>(descendantFolderIds);
                    folderIds.Add(contentFolderId.Value);
                    whereSql.Where("spb_cms_ContentItems.ContentFolderId in (@ContentFolderIds)", new { ContentFolderIds = folderIds });
                }

                switch (PubliclyAuditStatus)
                {
                case PubliclyAuditStatus.Fail:
                case PubliclyAuditStatus.Pending:
                case PubliclyAuditStatus.Again:
                case PubliclyAuditStatus.Success:
                    whereSql.Where("spb_cms_ContentItems.AuditStatus=@0", (int)PubliclyAuditStatus);
                    break;

                case PubliclyAuditStatus.Pending_GreaterThanOrEqual:
                case PubliclyAuditStatus.Again_GreaterThanOrEqual:
                    whereSql.Where("spb_cms_ContentItems.AuditStatus>@0", (int)PubliclyAuditStatus);
                    break;

                default:
                    break;
                }

                CountService countService = new CountService(TenantTypeIds.Instance().ContentItem());
                string countTableName = countService.GetTableName_Counts();
                StageCountTypeManager stageCountTypeManager = StageCountTypeManager.Instance(TenantTypeIds.Instance().ContentItem());
                int stageCountDays = 0;
                string stageCountType = string.Empty;
                switch (sortBy)
                {
                case ContentItemSortBy.ReleaseDate_Desc:
                    orderSql.OrderBy("spb_cms_ContentItems.IsGlobalSticky desc");
                    if (contentFolderId.HasValue && contentFolderId.Value > 0)
                    {
                        orderSql.OrderBy("spb_cms_ContentItems.IsFolderSticky desc");
                    }
                    orderSql.OrderBy("spb_cms_ContentItems.ReleaseDate desc");
                    break;

                case ContentItemSortBy.HitTimes:
                    sql.LeftJoin(string.Format("(select * from {0} WHERE ({0}.CountType = '{1}')) c", countTableName, CountTypes.Instance().HitTimes()))
                    .On("ContentItemId = c.ObjectId");
                    orderSql.OrderBy("c.StatisticsCount desc");
                    break;

                case ContentItemSortBy.StageHitTimes:
                    stageCountDays = stageCountTypeManager.GetMaxDayCount(CountTypes.Instance().HitTimes());
                    stageCountType = stageCountTypeManager.GetStageCountType(CountTypes.Instance().HitTimes(), stageCountDays);
                    sql.LeftJoin(string.Format("(select * from {0} WHERE ({0}.CountType = '{1}')) c", countTableName, stageCountType))
                    .On("ContentItemId = c.ObjectId");
                    orderSql.OrderBy("c.StatisticsCount desc");
                    break;

                case ContentItemSortBy.CommentCount:
                    sql.LeftJoin(string.Format("(select * from {0} WHERE ({0}.CountType = '{1}')) c", countTableName, CountTypes.Instance().CommentCount()))
                    .On("ContentItemId = c.ObjectId");
                    orderSql.OrderBy("c.StatisticsCount desc");
                    break;

                case ContentItemSortBy.StageCommentCount:
                    stageCountDays = stageCountTypeManager.GetMaxDayCount(CountTypes.Instance().CommentCount());
                    stageCountType = stageCountTypeManager.GetStageCountType(CountTypes.Instance().CommentCount(), stageCountDays);
                    sql.LeftJoin(string.Format("(select * from {0} WHERE ({0}.CountType = '{1}')) c", countTableName, stageCountType))
                    .On("ContentItemId = c.ObjectId");
                    orderSql.OrderBy("c.StatisticsCount desc");
                    break;

                case ContentItemSortBy.DisplayOrder:
                    orderSql.OrderBy("spb_cms_ContentItems.DisplayOrder, spb_cms_ContentItems.ContentItemId desc");
                    break;

                default:
                    orderSql.OrderBy("spb_cms_ContentItems.ReleaseDate desc");
                    break;
                }
                whereSql.Where("spb_cms_ContentItems.ReleaseDate < @0", DateTime.UtcNow);
                sql.Append(whereSql).Append(orderSql);
                return sql;
            }));
        }
        /// <summary>
        /// 依据查询条件获取ContentItem列表
        /// </summary>
        public PagingDataSet <ContentItem> GetContentItems(bool enableCaching, ContentItemQuery query, int pageSize, int pageIndex)
        {
            var sql      = Sql.Builder.Select("spb_cms_ContentItems.*").From("spb_cms_ContentItems");
            var whereSql = Sql.Builder;
            var orderSql = Sql.Builder;

            if (query.ContentFolderId.HasValue && query.ContentFolderId.Value > 0)
            {
                if (query.IncludeFolderDescendants.HasValue && query.IncludeFolderDescendants.Value)
                {
                    ContentFolderService        contentFolderService = new ContentFolderService();
                    IEnumerable <ContentFolder> contentFolders       = contentFolderService.GetDescendants(query.ContentFolderId.Value);

                    IEnumerable <int> descendantFolderIds = contentFolders == null ? new List <int>() : contentFolders.Select(f => f.ContentFolderId);

                    List <int> folderIds = new List <int>(descendantFolderIds);
                    folderIds.Add(query.ContentFolderId.Value);

                    whereSql.Where("spb_cms_ContentItems.ContentFolderId in (@ContentFolderIds)", new { ContentFolderIds = folderIds });
                }
                else
                {
                    whereSql.Where("spb_cms_ContentItems.ContentFolderId=@0", query.ContentFolderId.Value);
                }
            }
            else if (query.ModeratorUserId.HasValue && query.ModeratorUserId.Value > 0)
            {
                ContentFolderService          contentFolderService          = new ContentFolderService();
                ContentFolderModeratorService contentFolderModeratorService = new ContentFolderModeratorService();
                IEnumerable <int>             moderatedFolderIds            = contentFolderModeratorService.GetModeratedFolderIds(query.ModeratorUserId.Value);
                List <int> folderIds = new List <int>(moderatedFolderIds);
                if (query.IncludeFolderDescendants.HasValue && query.IncludeFolderDescendants.Value)
                {
                    foreach (var folderId in moderatedFolderIds)
                    {
                        IEnumerable <ContentFolder> contentFolders      = contentFolderService.GetDescendants(folderId);
                        IEnumerable <int>           descendantFolderIds = contentFolders == null ? new List <int>() : contentFolders.Select(f => f.ContentFolderId);
                        folderIds.AddRange(descendantFolderIds);
                    }
                }
                if (folderIds.Count > 0)
                {
                    whereSql.Where("spb_cms_ContentItems.ContentFolderId in (@ContentFolderIds)", new { ContentFolderIds = folderIds });
                }
            }

            if (query.ContentTypeId.HasValue && query.ContentTypeId.Value > 0)
            {
                whereSql.Where("spb_cms_ContentItems.ContentTypeId=@0", query.ContentTypeId.Value);
            }

            if (query.UserId.HasValue && query.UserId.Value > 0)
            {
                whereSql.Where("spb_cms_ContentItems.UserId=@0", query.UserId.Value);
            }

            if (query.IsContributed.HasValue)
            {
                whereSql.Where("spb_cms_ContentItems.IsContributed=@0", query.IsContributed.Value);
            }

            if (query.IsEssential.HasValue)
            {
                whereSql.Where("spb_cms_ContentItems.IsContributed=@0", query.IsEssential.Value);
            }

            if (query.IsSticky.HasValue)
            {
                whereSql.Where("spb_cms_ContentItems.IsGlobalSticky=@0", query.IsSticky.Value);
            }

            query.SubjectKeyword = StringUtility.StripSQLInjection(query.SubjectKeyword);
            if (!string.IsNullOrWhiteSpace(query.SubjectKeyword))
            {
                whereSql.Where("spb_cms_ContentItems.Title like @0", "%" + query.SubjectKeyword + "%");
            }

            query.TagNameKeyword = StringUtility.StripSQLInjection(query.TagNameKeyword);


            if (!string.IsNullOrWhiteSpace(query.TagName) || !string.IsNullOrWhiteSpace(query.TagNameKeyword))
            {
                sql.InnerJoin("tn_ItemsInTags").On("spb_cms_ContentItems.ContentItemId = tn_ItemsInTags.ItemId");
                if (!string.IsNullOrWhiteSpace(query.TagName))
                {
                    whereSql.Where("tn_ItemsInTags.TenantTypeId = @0", TenantTypeIds.Instance().ContentItem())
                    .Where("tn_ItemsInTags.TagName = @0", query.TagName);
                }
                else if (!string.IsNullOrWhiteSpace(query.TagNameKeyword))
                {
                    whereSql.Where("tn_ItemsInTags.TenantTypeId = @0", TenantTypeIds.Instance().ContentItem())
                    .Where("tn_ItemsInTags.TagName like @0", "%" + query.TagNameKeyword + "%");
                }
            }

            if (query.PubliclyAuditStatus.HasValue)
            {
                switch (query.PubliclyAuditStatus)
                {
                case PubliclyAuditStatus.Fail:
                case PubliclyAuditStatus.Pending:
                case PubliclyAuditStatus.Again:
                case PubliclyAuditStatus.Success:
                    whereSql.Where("spb_cms_ContentItems.AuditStatus=@0", (int)query.PubliclyAuditStatus.Value);
                    break;

                case PubliclyAuditStatus.Pending_GreaterThanOrEqual:
                case PubliclyAuditStatus.Again_GreaterThanOrEqual:
                    whereSql.Where("spb_cms_ContentItems.AuditStatus>@0", (int)query.PubliclyAuditStatus.Value);
                    break;

                default:
                    break;
                }
            }

            if (query.MinDate != null)
            {
                whereSql.Where("spb_cms_ContentItems.ReleaseDate >= @0", query.MinDate);
            }
            DateTime maxDate = DateTime.UtcNow;

            if (query.MaxDate != null)
            {
                maxDate = query.MaxDate.Value.AddDays(1);
            }
            whereSql.Where("spb_cms_ContentItems.ReleaseDate < @0", maxDate);

            CountService          countService          = new CountService(TenantTypeIds.Instance().ContentItem());
            string                countTableName        = countService.GetTableName_Counts();
            StageCountTypeManager stageCountTypeManager = StageCountTypeManager.Instance(TenantTypeIds.Instance().ContentItem());
            int    stageCountDays = 0;
            string stageCountType = string.Empty;

            switch (query.SortBy)
            {
            case ContentItemSortBy.ReleaseDate_Desc:
                orderSql.OrderBy("spb_cms_ContentItems.IsGlobalSticky desc");
                if (query.ContentFolderId.HasValue && query.ContentFolderId.Value > 0)
                {
                    orderSql.OrderBy("spb_cms_ContentItems.IsFolderSticky desc");
                }
                orderSql.OrderBy("spb_cms_ContentItems.ReleaseDate desc");
                break;

            case ContentItemSortBy.HitTimes:
                sql.LeftJoin(string.Format("(select * from {0} WHERE ({0}.CountType = '{1}')) c", countTableName, CountTypes.Instance().HitTimes()))
                .On("ContentItemId = c.ObjectId");
                orderSql.OrderBy("c.StatisticsCount desc");
                break;

            case ContentItemSortBy.StageHitTimes:
                stageCountDays = stageCountTypeManager.GetMaxDayCount(CountTypes.Instance().HitTimes());
                stageCountType = stageCountTypeManager.GetStageCountType(CountTypes.Instance().HitTimes(), stageCountDays);
                sql.LeftJoin(string.Format("(select * from {0} WHERE ({0}.CountType = '{1}')) c", countTableName, stageCountType))
                .On("ContentItemId = c.ObjectId");
                orderSql.OrderBy("c.StatisticsCount desc");
                break;

            case ContentItemSortBy.CommentCount:
                sql.LeftJoin(string.Format("(select * from {0} WHERE ({0}.CountType = '{1}')) c", countTableName, CountTypes.Instance().CommentCount()))
                .On("ContentItemId = c.ObjectId");
                orderSql.OrderBy("c.StatisticsCount desc");
                break;

            case ContentItemSortBy.StageCommentCount:
                stageCountDays = stageCountTypeManager.GetMaxDayCount(CountTypes.Instance().CommentCount());
                stageCountType = stageCountTypeManager.GetStageCountType(CountTypes.Instance().CommentCount(), stageCountDays);
                sql.LeftJoin(string.Format("(select * from {0} WHERE ({0}.CountType = '{1}')) c", countTableName, stageCountType))
                .On("ContentItemId = c.ObjectId");
                orderSql.OrderBy("c.StatisticsCount desc");
                break;

            case ContentItemSortBy.DisplayOrder:
                orderSql.OrderBy("spb_cms_ContentItems.DisplayOrder, spb_cms_ContentItems.ContentItemId desc");
                break;

            default:
                orderSql.OrderBy("spb_cms_ContentItems.ReleaseDate desc");
                break;
            }
            sql.Append(whereSql).Append(orderSql);
            PagingDataSet <ContentItem> pds = null;

            if (enableCaching && string.IsNullOrEmpty(query.SubjectKeyword) && string.IsNullOrEmpty(query.TagNameKeyword) && query.MinDate == null && query.MaxDate == null)
            {
                pds = GetPagingEntities(pageSize, pageIndex, CachingExpirationType.ObjectCollection,
                                        () =>
                {
                    StringBuilder cacheKey = new StringBuilder(RealTimeCacheHelper.GetListCacheKeyPrefix(query));
                    cacheKey.AppendFormat("contentFolderId-{0}:includeFolderDescendants-{1}:contentTypeId-{2}:userId-{3}:isContributed-{4}:isEssential-{5}:isSticky-{6}:PubliclyAuditStatus-{7}:TagName-{8}:ModeratorUserId-{9}",
                                          query.ContentFolderId.ToString(), query.IncludeFolderDescendants.ToString(), query.ContentTypeId.ToString(), query.UserId.ToString(),
                                          query.IsContributed.ToString(), query.IsEssential.ToString(), query.IsSticky.ToString(), query.PubliclyAuditStatus.ToString(), query.TagName, query.ModeratorUserId);

                    return(cacheKey.ToString());
                },
                                        () =>
                {
                    return(sql);
                });
            }
            else
            {
                pds = GetPagingEntities(pageSize, pageIndex, sql);
            }

            return(pds);
        }
Exemple #6
0
        /// <summary>
        /// 将EditModel转换成数据库实体
        /// </summary>
        public ContentItem AsContentItem(System.Web.HttpRequestBase Request)
        {
            ContentItem contentItem = null;

            if (this.ContentItemId > 0)
            {
                contentItem = new ContentItemService().Get(this.ContentItemId);
            }
            else
            {
                contentItem               = new ContentItem();
                contentItem.Author        = UserContext.CurrentUser == null ? "" : UserContext.CurrentUser.DisplayName;
                contentItem.IP            = WebUtility.GetIP();
                contentItem.UserId        = UserContext.CurrentUser == null ? 0 : UserContext.CurrentUser.UserId;
                contentItem.ContentTypeId = this.ContentTypeId;
            }

            if (this.ContentFolderId > 0)
            {
                ContentFolder folder = new ContentFolderService().Get(this.ContentFolderId);
                if (folder != null)
                {
                    contentItem.ContentFolderId = this.ContentFolderId;
                    if (this.AdditionalProperties == null)
                    {
                        this.AdditionalProperties = new Dictionary <string, object>();
                    }
                    IEnumerable <ContentTypeColumnDefinition> contentTypeColumnDefinitions = new MetadataService().GetColumnsByContentTypeId(this.ContentTypeId);
                    foreach (var item in contentTypeColumnDefinitions)
                    {
                        object value = null;


                        switch (item.DataType)
                        {
                        case "int":
                        case "long":
                            value = Request.Form.Get <long>(item.ColumnName, 0);
                            break;

                        case "datetime":
                            value = Request.Form.Get <DateTime>(item.ColumnName, DateTime.MinValue);
                            break;

                        case "bool":
                            value = Request.Form.Get <bool>(item.ColumnName, false);
                            break;

                        default:
                            value = Request.Form.Get <string>(item.ColumnName, string.Empty);
                            break;
                        }

                        if (this.AdditionalProperties.ContainsKey(item.ColumnName))
                        {
                            this.AdditionalProperties[item.ColumnName] = value;
                        }
                        else
                        {
                            this.AdditionalProperties.Add(item.ColumnName, value);
                        }
                    }
                }
            }
            contentItem.AdditionalProperties = this.AdditionalProperties;
            contentItem.IsEssential          = false;
            contentItem.IsLocked             = false;

            contentItem.IsGlobalSticky = this.IsGlobalSticky;
            if (this.GlobalStickyDate.CompareTo(DateTime.MinValue) > 0)
            {
                contentItem.GlobalStickyDate = this.GlobalStickyDate;
            }
            contentItem.IsFolderSticky = this.IsFolderSticky;
            if (this.FolderStickyDate.CompareTo(DateTime.MinValue) > 0)
            {
                contentItem.FolderStickyDate = this.FolderStickyDate;
            }
            contentItem.DisplayOrder = this.DisplayOrder;
            contentItem.FeaturedImageAttachmentId = this.FeaturedImageAttachmentId;
            contentItem.LastModified = DateTime.UtcNow;
            contentItem.Title        = this.Title;
            if (this.ReleaseDate.CompareTo(DateTime.MinValue) > 0)
            {
                contentItem.ReleaseDate = this.ReleaseDate.ToUniversalTime();
            }
            //摘要
            contentItem.Summary = this.Summary ?? string.Empty;
            if (this.TrimBodyAsSummary)
            {
                string summary = HtmlUtility.TrimHtml(Request.Form.Get <string>("Body", string.Empty), TextLengthSettings.TEXT_DESCRIPTION_MAXLENGTH);
                contentItem.Summary = summary;
            }

            if (contentItem.AdditionalProperties.ContainsKey("AutoPage"))
            {
                bool   autoPage   = Request.Form.Get <bool>("AutoPage", false);
                int    pageLength = Request.Form.Get <int>("PageLength", 1000);
                string body       = contentItem.AdditionalProperties.Get <string>("Body", string.Empty);
                if (autoPage)
                {
                    pageLength = pageLength > 0 ? pageLength : 1000;
                    if (!string.IsNullOrEmpty(body))
                    {
                        body = body.Replace(ContentPages.PageSeparator, "");
                        contentItem.AdditionalProperties["Body"] = string.Join(ContentPages.PageSeparator, ContentPages.GetPageContentForStorage(body, pageLength, true).ToArray());
                    }
                }
                else
                {
                    pageLength = 0;
                    body       = body.Replace(ContentPages.PageSeparator, "");
                    contentItem.AdditionalProperties["Body"]       = body;
                    contentItem.AdditionalProperties["pageLength"] = pageLength;
                }
            }

            if (contentItem.AdditionalProperties.ContainsKey("Editor"))
            {
                string editor = contentItem.AdditionalProperties.Get <string>("Editor", string.Empty);
                if (string.IsNullOrEmpty(editor))
                {
                    contentItem.AdditionalProperties["Editor"] = contentItem.ContentFolder.Editor;
                }
            }

            if (contentItem.FeaturedImageAttachmentId > 0)
            {
                AttachmentService <Attachment> attachmentService = new AttachmentService <Attachment>(TenantTypeIds.Instance().ContentItem());
                Attachment attachment = attachmentService.Get(contentItem.FeaturedImageAttachmentId);
                if (attachment != null)
                {
                    contentItem.FeaturedImage = attachment.GetRelativePath() + "\\" + attachment.FileName;
                }
                else
                {
                    contentItem.FeaturedImageAttachmentId = 0;
                }
            }
            else
            {
                contentItem.FeaturedImage = string.Empty;
            }
            return(contentItem);
        }