Exemplo n.º 1
0
        public async Task <IActionResult> Upload(IFormFile formImage)
        {
            var imageName = formImage.FileName;
            var stream    = formImage.OpenReadStream();

            var uri = await imageUploadService.UploadImage(imageName, stream);

            var image = new Image
            {
                FileName = imageName,
                Size     = formImage.Length,
                Url      = uri.ToString()
            };

            await imageService.SaveImage(image);

            await messageQueueService.EnqueueMessage(image);

            return(RedirectToAction(nameof(Index)));
        }