public ActionResult Approve(int id) { Article article = _context.Articles.Find(id); if (article == null) { return(HttpNotFound()); } article.Accept(); _context.SaveChanges(); return(RedirectToAction("Waiting")); }
/// <summary> /// 接受文章首页申请 /// </summary> /// <param name="ArticleId"></param> /// <returns></returns> public ActionResult Accept(string ArticleId) { if (string.IsNullOrEmpty(ArticleId)) { return(Redirect("/")); } if (Session[ConstHelper.Session_USERID] == null) { return(Redirect("/")); } if ((UserType)Session[ConstHelper.Session_PRIVILEGE] != UserType.Admin && (UserType)Session[ConstHelper.Session_PRIVILEGE] != UserType.Editor) { return(Redirect("/")); } if (Article.GetArticleBySn(ArticleId) == null) { return(Redirect("/")); } Article.Accept(ArticleId); Article article = Article.GetArticleBySn(ArticleId); var articleurl = "<a href = '/Article/Index?ArticleId=" + article.Sn + "'>" + article.Title + "</a>"; SiteMessage.CreateNotify(article.OwnerId, "您的文章[" + articleurl + "]通过审核"); if (article.IsPutToMyTopic) { //发布后则加入到自己专题 var topic = Topic.GetTopicByAccountId(article.OwnerId); if (topic != null) { TopicArticle.InsertTopicArticle(new TopicArticle() { ArticleID = article.Sn, TopicID = topic.Sn, PublishStatus = ApproveStatus.NotNeed }); } } return(Redirect("/Admin")); }