Esempio n. 1
0
        public IActionResult UnDisLikeComment([FromBody] CommentIdModel model)
        {
            CommentLikeReturnModel ret;

            if (model == null)
            {
                return(BadRequest());
            }
            Claim idClaim = User.FindFirst("sub");

            if (idClaim == null)
            {
                return(StatusCode(401));
            }
            else
            {
                ret = _commentActionService.UnDislikeComment(idClaim.Value, model.CommentId);
                if (ret.IsActionSucceed)
                {
                    _bus.Publish <UserUndislikedCommentAction>(new UserUndislikedCommentAction()
                    {
                        DateUtcAction = DateTime.UtcNow,
                        CommentId     = model.CommentId,
                        UserId        = idClaim.Value
                    });
                }
            }
            return(Ok(ret));
        }
Esempio n. 2
0
        public IActionResult DeleteComment([FromBody] CommentIdModel model)
        {
            BaseReturnModel ret;

            if (model == null)
            {
                return(BadRequest());
            }
            Claim idClaim = User.FindFirst("sub");

            if (idClaim == null)
            {
                return(Unauthorized());
            }
            else
            {
                ret = _commentActionService.RemoveComment(model.CommentId, idClaim.Value);
            }
            return(Ok(ret));
        }