Ejemplo n.º 1
0
        public async Task <Result> DeleteAlbum(string id)
        {
            Album album = await _albumRepository.FindAsync(id);

            List <string>       imageVariantsIds = new List <string>();
            List <UploadedFile> uploadedFiles    = new List <UploadedFile>();

            if (album.Images != null)
            {
                album.Images.ForEach(image =>
                {
                    imageVariantsIds.AddRange(GetImageVariantsIds(image));
                });

                uploadedFiles = await _uploadedFilesRepository.
                                DeleteUploadedFiles(imageVariantsIds);

                await _blobStore.DeleteBlobs(GetBlobsIds(uploadedFiles));
            }

            await _albumRepository.DeleteAsync(id);

            return(new Result()
            {
                Success = true
            });
        }