Exemplo n.º 1
0
        /// <summary>
        /// 添加评论信息
        /// </summary>
        /// <returns></returns>
        public ActionResult AddComment()
        {
            int    id  = int.Parse(Request["id"]);
            string msg = Request["msg"];

            if (SensitiveWordBLL.IsForbidWord(msg))
            {
                return(Content("no:您的评论包含禁用词,不允许评论"));
            }
            else if (SensitiveWordBLL.IsModWord(msg))
            {
                ArticelComment articelComment = new ArticelComment()
                {
                    AddDate   = DateTime.Now,
                    ArticelID = id,
                    IsPass    = 0,
                    Msg       = msg
                };
                ArticelCommentBLL.AddEntity(articelComment);
                return(Content("no:您的评论包含审查词,需要审核"));
            }
            else
            {
                msg = SensitiveWordBLL.ReplaceWord(msg);
                ArticelComment articelComment = new ArticelComment()
                {
                    AddDate   = DateTime.Now,
                    ArticelID = id,
                    IsPass    = 1,
                    Msg       = msg
                };
                ArticelCommentBLL.AddEntity(articelComment);
                return(Content("ok:评论成功"));
            }
        }
        /// <summary>
        /// 完成评论的添加
        /// </summary>
        /// <returns></returns>
        public ActionResult AddArticelComment()
        {
            int    articelId = int.Parse(Request["articelId"]);
            string msg       = Request["msg"];

            if (SensitiveWordService.FilterFobidWord(msg))
            {
                return(Content("no:评论中含有禁用词!!"));
            }
            else if (SensitiveWordService.FilterModWord(msg))
            {
                ArticelComment articelComment = new ArticelComment();
                articelComment.AddDate   = DateTime.Now;
                articelComment.IsPass    = 0;
                articelComment.Msg       = msg;
                articelComment.ArticelID = articelId;
                ArticelCommentService.AddEntity(articelComment);
                return(Content("no:评论待审查!!"));
            }
            else
            {
                ArticelComment articelComment = new ArticelComment();
                articelComment.AddDate   = DateTime.Now;
                articelComment.IsPass    = 1;
                articelComment.Msg       = msg;
                articelComment.ArticelID = articelId;
                ArticelCommentService.AddEntity(articelComment);
                return(Content("ok:评论成功"));
            }
        }