Exemplo n.º 1
0
        public async Task <IActionResult> AddNew(List <IFormFile> Images)
        {
            foreach (var image in Images)
            {
                var gallery = new Gallery();
                using (var memoryStream = new MemoryStream())
                {
                    await image.CopyToAsync(memoryStream);

                    gallery.ImageData = memoryStream.ToArray();
                    gallery.ImageMime = image.ContentType;
                }

                var result = Services.AddGallery(gallery);
            }

            return(RedirectToAction("Index", "GalleryMVC"));
        }