public ActionResult AddTravelFeedComment(ETravelComment comment)
 {
     comment.CommentUserId = Passport.User.Id;
     var newComment = _travelService.AddTravelFeedComment(comment);
     return JsonResult(newComment, "发表成功");
 }
Beispiel #2
0
 public ETravelComment AddTravelFeedComment(ETravelComment comment)
 {
     comment.CommentTime = DateTime.Now;
     _rep.Add(comment);
     var sb = new StringBuilder();
     sb.Append("select c.*,");
     sb.Append("u0.NickName as ExtCommentTargetNickName,u0.UserAvatar as ExtCommentTargetUserAvatar,");
     sb.Append("u1.NickName as ExtCommentNickName,u1.UserAvatar as ExtCommentUserAvatar ");
     sb.Append("from travel_comment c ");
     sb.Append("left join core_user u0 on c.CommentTargetUserId=u0.Id ");
     sb.Append("left join core_user u1 on c.CommentUserId=u1.Id ");
     sb.Append("where c.TravelTargetType=" + (int)EnumTravelTargetType.Feed + " ");
     sb.Append("and c.Id=" + comment.Id+";");
     sb.Append("update travel_travel_feed set FeedCommentCount=FeedCommentCount+1 where Id=" +comment.CommentTargetId + ";");
     //获取评论
     return _rep.GetTSqlCommand(sb.ToString()).ToEntity<ETravelComment>();
 }