Beispiel #1
0
        public async Task <IActionResult> DeleteAsync(string postId, Guid commentId)
        {
            try
            {
                var comment = await _postCommentService.GetAsyncFromPost(postId, commentId);

                if (!comment.UserId.HavePermissions(User))
                {
                    return(Unauthorized());
                }
                await _postCommentService.DeleteAsync(postId, commentId);

                return(Ok());
            }
            catch (Exception e)
            {
                _logger.LogError($"Returning exception: {e.Message}");
                return(Json(new ExceptionDto
                {
                    Error = e.Message
                }));
            }
        }