Пример #1
0
        public async Task <IActionResult> DeleteAsync(int id, int postId)
        {
            var userOwnsPost = await _postService.UserOwnsPostAsync(postId, User.FindFirstValue(ClaimTypes.NameIdentifier));

            if (!userOwnsPost)
            {
                return(BadRequest(new Response(false, "You do not own this post.")));
            }

            await _pictureService.DeletePictureAync(id);

            return(NoContent());
        }