예제 #1
0
        public async Task <ActionResult> DeleteComment(string commentId)
        {
            try
            {
                if (Guid.TryParse(commentId, out Guid gCommentId))
                {
                    await _postCommentService.DeleteCommentAsync(gCommentId);

                    return(NoContent());
                }
                else
                {
                    return(BadRequest($"{commentId} is not valid guid."));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error occured during removing the comment. Coment id: {postId}", commentId);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }