public IActionResult Upvote(string commentId)
        {
            int commentIdI;

            if (!int.TryParse(commentId, out commentIdI))
            {
                return(Json(new { success = false, error = "Invalid comment ID." }));
            }

            Comment cmt = commentRepository.GetById(commentIdI);

            if (cmt == null)
            {
                return(Json(new { success = false, error = "Comment not found." }));
            }
            if (cmt.Author == loginHandler.LoggedInUserId(HttpContext).Value)
            {
                return(Json(new { success = false, error = "You can't vote for your own comments." }));
            }

            bool success = commentVoteRepository.Add(new CommentVote(VoteType.Upvote, loginHandler.LoggedInUserId(HttpContext).Value, commentIdI));

            if (success)
            {
                return(Json(new { success = true }));
            }
            else
            {
                return(Json(new { success = false, error = "Couldn't vote. Have you already voted?" }));
            }
        }
 public CommentVote Add(CommentVote commentVote)
 {
     return(_commentVoteRepository.Add(commentVote));
 }