Ejemplo n.º 1
0
        public async Task <IEnumerable <string> > GetProcessedImages()
        {
            var processedImagesContainerName = "processed-images";

            var storage         = new AzureStorageBlobClient(Startup.StorageConnectionString);
            var processedImages = await storage.GetUriBlobsNewestFirst(processedImagesContainerName);

            return(processedImages);
        }
        public async Task <IActionResult> SendSelectedImages([FromBody] string[] selectedImages)
        {
            if (Startup.StorageConnectionString == null)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Registra la key Azure:StorageConnectionString"));
            }

            var httpClient = new HttpClient();
            var storage    = new AzureStorageBlobClient(Startup.StorageConnectionString);
            var originalImagesContainerName = "original-images";

            foreach (var selectedImage in selectedImages)
            {
                var fileName = $"{Guid.NewGuid()}.jpg";

                var downloadedImage = await httpClient.GetByteArrayAsync(selectedImage);

                await storage.AddFileAsync(originalImagesContainerName, fileName, downloadedImage);
            }

            return(Ok());
        }