public async Task <IActionResult> EkleCoklu(List <IFormFile> photo, ProductModel pm, int id) { List <Gallery> glry = new List <Gallery>(); if (photo == null || photo.Count == 0) { return(Content("Resim Bulunamadı")); } else { foreach (var item in photo) { var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/", item.FileName); var stream = new FileStream(path, FileMode.Create); await item.CopyToAsync(stream); glry.Add(new Gallery { ProductId = pm.Products.ProductId, Image = item.FileName }); } foreach (var item in glry) { _db.Entry(item).State = Microsoft.EntityFrameworkCore.EntityState.Added; } } await _rep.Save(); return(RedirectToAction("ProductsListe", "Products")); //return RedirectToPage("Liste", "Gallery" + id); }