コード例 #1
0
        public async Task <Photo> RemoveAsync(int id)
        {
            Photo photo = await FindAsync(id);

            var user = await userService.GetUserAsync();

            if (await photosAuthorizationService.ItemMayBeDeletedAsync(user, photo))
            {
                return(await repository.RemoveAsync(id));
            }
            else
            {
                throw new UnauthorizedDeleteAttemptException <Photo>($"Unauthorized Deletion Attempt of Photo {photo.Id}");
            }
        }
コード例 #2
0
 public async Task <Photo> RemoveAsync(int id, string tokenValue) => await _photosRepository.RemoveAsync(id, tokenValue);
コード例 #3
0
 public async Task <Photo> RemoveAsync(int id)
 {
     _logger.LogInformation("RemoveAsync called", id);
     return(await _photosRepository.RemoveAsync(id));
 }