Example #1
0
        private async Task <bool> UploadImage(string imageUrl, string upc, string imagePath)
        {
            var imageData = await _imageService.CreateUploadedImage(imageUrl, upc, imagePath);

            if (imageData == null)
            {
                return(false);
            }
            await _imageService.AddImageToBlobStorageAsync(imageData);

            _processLog.WriteLine("Saved Image: " + imageUrl);
            return(true);
        }
        public async Task <ActionResult> Index(HttpPostedFileBase image)
        {
            try
            {
                ImageService imageService  = new ImageService();
                var          uploadedImage = await imageService.CreateUploadedImage(image);

                await imageService.AddImageToBlobStorageAsync(uploadedImage);

                TempData.Add("Sucesso", "Sucesso");
            }
            catch (Exception)
            {
                TempData.Add("Erro", "Erro");
            }
            return(RedirectToAction("Index"));
        }