Exemplo n.º 1
0
        public async Task DeleteAsync(string imagePath)
        {
            var result = new ImageResult {
                NewPath = null
            };

            await DeleteBlob(imagePath);
        }
Exemplo n.º 2
0
        public async Task <ImageResult> AddAsync(ImageData image, string oldPath)
        {
            var            nameForImage = Path.GetRandomFileName();
            var            imageData    = Convert.FromBase64String(image.Content);
            CloudBlockBlob blob         = _cloudBlobContainer.GetBlockBlobReference($"{nameForImage}{image.Extension}");

            await DeleteBlob(oldPath);

            await blob.UploadFromByteArrayAsync(imageData, 0, imageData.Length);

            var resultPath = $"{_storageAccountPath}/{_blobContainerName}/{nameForImage}{image.Extension}";
            var result     = new ImageResult {
                NewPath = resultPath
            };

            return(result);
        }