public JsonResult PostArticleReplyComment(string ReplyID, string Content) { var getComment = _articleCommentService.QueryWhere(t => t.Id == ReplyID); var count = _articleCommentReplyService.GetList(t => t.ArticleCommentId == ReplyID).Count(); getComment.ReplyId = ReplyID; getComment.ReplyCount = (count + 1).ToString(); var model = new ArticleCommentReply(); model.Id = ResultHelper.NewId; model.AddedDate = ResultHelper.NowTime; model.Content = Content; model.ArticleCommentId = ReplyID; //member infomation model.Email = "*****@*****.**"; model.UpId = "0"; if (model != null) { _articleCommentReplyService.Insert(model); _articleCommentService.Update(getComment); return(Json(JsonHandler.CreateMessage(1, Akic.Core.Suggestion.InsertSucceed))); } else { return(Json(JsonHandler.CreateMessage(0, Akic.Core.Suggestion.InsertFail))); } }
public ActionResult AddReplies(List <ReplyModel> replies) { if (replies != null) { var db = new VITVContext(); foreach (var replyModel in replies) { var reply = new ArticleCommentReply { ArticleCommentId = replyModel.CommentId, Content = replyModel.Content, UserId = User.Identity.GetUserId(), CreatedTime = DateTime.Now }; db.ArticleCommentReplies.Add(reply); } db.SaveChanges(); } return(Json(new { success = true })); }
/// <summary> /// Updates the comment asynchronous. /// </summary> /// <param name="comment">The comment.</param> /// <returns></returns> public virtual Task <ArticleCommentReply> UpdateCommentAsync(ArticleCommentReply comment) { return(UpdateCommentAsync <ArticleCommentReply>(comment)); }