public ActionResult IlanEkle(Ads ads) { int adsId = ads.Id; var Id = HttpContext.Session.GetInt32("ıd"); if (Id == null) { return(Redirect("~/Account/Login")); } if (ads.CoverPhoto != null) { string folder = "Images/"; ads.PetPhoto = UploadImage(folder, ads.CoverPhoto); //var tempPath=Guid.NewGuid().ToString() + "_" + ads.CoverPhoto.FileName; //folder += tempPath; // string serverFolder = Path.Combine(_env.WebRootPath,folder); // ads.PetPhoto ="/"+ folder; // ads.CoverPhoto.CopyTo(new FileStream(serverFolder, FileMode.Create)); } //if (ads.GalleryFiles != null) //{ // string folder = "Images/Gallery/"; // var fotolar = new AdsGallery(); // ads.Gallery = new List<GalleryModel>(); // foreach (var file in ads.GalleryFiles) // { // var gallery = new GalleryModel() // { // Name = file.FileName, // URL = UploadImage(folder, file) // }; // ads.Gallery.Add(gallery); // } //} ads.UsersId = Convert.ToInt32(Id); _adsService.Add(ads); return(RedirectToAction("IlanEkle")); }