Пример #1
0
        /// <summary>
        /// 收录到主题
        /// </summary>
        /// <param name="topicId"></param>
        /// <param name="articleId"></param>
        /// <returns></returns>
        public static bool PutToTopic(string topicOwnerid, string articleId)
        {
            IMongoQuery OwnerQuery = Query.EQ(nameof(Topic.OwnerId), topicOwnerid);
            var         topic      = MongoDbRepository.GetFirstRec <Topic>(OwnerQuery);

            if (topic == null)
            {
                return(false);
            }
            if (IsExist(topic.Sn, articleId))
            {
                return(false);
            }
            //是否能够被收录
            var article = Article.GetArticleBySn(articleId);

            if (!article.IsTopicable)
            {
                return(false);
            }
            if (article.IsNeedTopicApproval)
            {
                var topicarticle = new TopicArticle()
                {
                    ArticleID     = articleId,
                    TopicID       = topic.Sn,
                    PublishStatus = ApproveStatus.Pending
                };
                InsertTopicArticle(topicarticle);
                var user       = UserInfo.GetUserInfoBySn(topicOwnerid);
                var parm       = "TopicOwnerId=" + topicOwnerid + "&ArticleId=" + articleId;
                var articleurl = "<a href = '/Article/Index?ArticleId=" + article.Sn + "'>" + article.Title + "</a>";
                var topicurl   = "<a href = '/Author/TopicPage?accountid=" + topicOwnerid + "'>" + topic.Title + "</a>";
                SiteMessage.CreateYesNo(article.OwnerId, "[" + user.NickName + "]请求收录您的文章:[" + articleurl + "]到他的专题" + topicurl, "/Author/AcceptTopic?" + parm, "/Author/RefuseTopic?" + parm, topicOwnerid);
            }
            else
            {
                var topicarticle = new TopicArticle()
                {
                    ArticleID     = articleId,
                    TopicID       = topic.Sn,
                    PublishStatus = ApproveStatus.Accept
                };
                InsertTopicArticle(topicarticle);
            }
            return(true);
        }
Пример #2
0
 /// <summary>
 /// 删除专题文章
 /// </summary>
 /// <param name="DropTopicArticle"></param>
 public static void DropTopicArticle(TopicArticle DropTopicArticle)
 {
     MongoDbRepository.DeleteRec(DropTopicArticle);
 }
Пример #3
0
 /// <summary>
 /// 修改专题文章
 /// </summary>
 /// <param name="OldTopicArticle"></param>
 public static void UpdateTopicArticle(TopicArticle OldTopicArticle)
 {
     MongoDbRepository.UpdateRec(OldTopicArticle);
 }
Пример #4
0
 /// <summary>
 /// 插入专题文章
 /// </summary>
 /// <param name="Newtopicarticle"></param>
 /// <returns>序列号</returns>
 public static string InsertTopicArticle(TopicArticle NewTopicArticle)
 {
     return(MongoDbRepository.InsertRec(NewTopicArticle));
 }