Esempio n. 1
0
        public async Task<IActionResult> BlockCommentCreationForPost([FromRoute] Guid postId, Guid id)
        {
            if (!await _postRepository.PostExistsAsync(postId))
            {
                return NotFound();
            }

            if (await _commentRepository.CommentExistsAsync(postId, id))
            {
                return StatusCode(409, new
                {
                    Error = "A Comment with this Id already exists. " +
                     "You cannot create resources by commenting to this endpoint"
                });
            }

            return NotFound();
        }