Ejemplo n.º 1
0
        public IResult UpdateArticleComment(UpdateArticleCommentDto updateArticleCommentDto)
        {
            var user           = _authService.GetAuthenticatedUser().Result.Data;
            var articleComment = _uow.ArticleComments.Get(x => x.Id == updateArticleCommentDto.ArticleCommentId);

            var errorResult = BusinessRules.Run(CheckAuthenticatedUserExist(), IsArticleCommentExist(updateArticleCommentDto.ArticleCommentId),
                                                IsArticleCommentBelongToUser(user.Id, articleComment.Id));



            articleComment.Comment = updateArticleCommentDto.Comment;
            _uow.ArticleComments.Update(articleComment);
            _uow.Commit();
            return(new SuccessResult(Message.ArticleCommentUpdated));
        }
Ejemplo n.º 2
0
        public IActionResult Comments(UpdateArticleCommentDto updateArticleCommentDto)
        {
            var result = this._articleService.UpdateArticleComment(updateArticleCommentDto);

            if (result.ResultType == ResultType.UnAuthorized)
            {
                return(Unauthorized());
            }

            if (result.ResultType == ResultType.Success)
            {
                return(Ok(result.Message));
            }

            return(BadRequest(result.Message));
        }