public ActionResult ArtReplyMsg(int artreplyid, string artreplymsg) { JsonResult <string> result = new JsonResult <string>(); ArticleCommentServicese commnetServices = new ArticleCommentServicese(); if (artreplyid > 0) { article_comment add = new article_comment(); add.add_time = DateTime.Now; add.is_del = false; add.is_reply = false; add.content = artreplymsg; add.reply_id = null; add.article_id = artreplyid; if (commnetServices.Add(add) > 0) { result.Success(); } else { result.Fail("无法进行回复"); } } else { result.Fail("该文章不存在,无法回复"); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 评论回复 /// </summary> /// <param name="msgid"></param> /// <param name="replymsg"></param> /// <returns></returns> public ActionResult ReplyMsg(int msgid, string replymsg) { JsonResult <string> result = new JsonResult <string>(); ArticleCommentServicese commnetServices = new ArticleCommentServicese(); var msg = commnetServices.query.Where(q => q.id == msgid).Where(q => q.is_del != true).FirstOrDefault(); if (msg != null) { article_comment add = new article_comment(); add.add_time = DateTime.Now; add.is_del = false; add.is_reply = true; add.content = replymsg; add.reply_id = msgid; add.article_id = msg.article_id; if (commnetServices.Add(add) > 0) { result.Success(); } else { result.Fail("无法进行回复"); } } else { result.Fail("该评论不存在,无法回复"); } return(Json(result, JsonRequestBehavior.AllowGet)); }