Beispiel #1
0
        public JsonResult GetTweetComment(string id)
        {
            Guid tweetID = new Guid(id);

            BirdComment comment = _birdCommentService.GetLastOrDefault(x => x.BirdTweetID == tweetID);

            return(Json(new
            {
                BirdUserImagePath = comment.BirdUser.ImagePath,
                UserName = comment.BirdUser.UserName,
                CreatedDate = comment.CreatedDate.ToString(),
                Content = comment.CommentContent
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public JsonResult AddComment(string userComment, Guid id)
        {
            BirdComment comment = new BirdComment();

            comment.BirdUserID     = _birdUserService.FindByUserName(HttpContext.User.Identity.Name).ID;
            comment.BirdTweetID    = id;
            comment.CommentContent = userComment;

            bool isAdded = false;

            try
            {
                _birdCommentService.Add(comment);
                isAdded = true;
            }
            catch (Exception)
            {
                isAdded = false;
            }
            return(Json(isAdded, JsonRequestBehavior.AllowGet));
        }