Beispiel #1
0
        public async Task Delete(Guid userId, Guid photoId)
        {
            var photoDB = await _photosRepository.GetById(photoId);

            if (photoDB == null)
            {
                throw new ArgumentException("Photo not found");
            }
            if (photoDB.UserId != userId)
            {
                throw new ArgumentException("Photo doesn't belong to user");
            }

            await Task.WhenAll(_photosRepository.Delete(photoDB),
                               _feedService.DeletePhotoFromFeed(userId, photoDB));
        }