Exemplo n.º 1
0
        public async Task <PortfolioCommentDTO> UpdatePortfolioComment(PortfolioCommentToUpdateDTO x)
        {
            PortfolioComment comment = await _commentRepo.GetPortfolioCommentByIdAsync(x.CommentId);

            comment.Message = x.Message;
            return(ConvertComment(await _genericRepo.UpdateAsync(comment)));
        }
        public async Task <IActionResult> Post(PortfolioCommentToUpdateDTO comment)
        {
            comment.Message = _javaScriptEncoder.Encode(_htmlEncoder.Encode(comment.Message));

            if (await _commentServices.GetPortfolioCommentById(comment.CommentId) == null)
            {
                return(StatusCode(400, "Comment with id " + comment.CommentId + " was not found."));
            }
            await _commentServices.UpdatePortfolioComment(comment);

            return(StatusCode(200));
        }