public ActionResult Add(Estate record, HttpPostedFileBase uploadfile, IEnumerable <HttpPostedFileBase> attachments, HttpPostedFileBase fileDosya) { var languages = LanguageManager.GetLanguages(); //string lang = ""; //if (RouteData.Values["lang"] == null) // lang = "tr"; //else lang = RouteData.Values["lang"].ToString(); //lang = var countries = EstateManager.GetCountryList(); var list = new SelectList(languages, "Culture", "Language"); ViewBag.LanguageList = list; var countrylist = new SelectList(countries, "Id", "Name"); ViewBag.Country = countrylist; if (ModelState.IsValid) { if (Session["ModifiedImageId"] != null) { record.Photo = "/Content/images/userfiles/" + Session["ModifiedImageId"].ToString() + Session["WorkingImageExtension"].ToString(); ImageHelperNew.DestroyImageCashAndSession(0, 0); } else { record.Photo = "/Content/images/front/noimage.jpeg"; } if (fileDosya != null) { fileDosya.SaveAs(Server.MapPath("/Content/images/estates/") + fileDosya.FileName); record.EmlakDosyasi = "/Content/images/estates/" + fileDosya.FileName; } ViewBag.ProcessMessage = EstateManager.AddEstate(record); Session.Remove("UploadType"); foreach (var item in attachments) { if (item != null && item.ContentLength > 0) { Random random = new Random(); int rand = random.Next(1000, 99999999); new ImageHelper(1024, 768).SaveThumbnail(item, "/Content/images/userfiles/", Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(item.FileName)); Photo p = new Photo(); p.CategoryId = (int)PhotoType.Estate; p.ItemId = record.Id; p.Path = "/Content/images/userfiles/" + Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(item.FileName); p.Thumbnail = "/Content/images/userfiles/" + Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(item.FileName); p.Online = true; p.SortOrder = 9999; p.Language = record.Language; p.TimeCreated = DateTime.Now; p.Title = record.Header; PhotoManager.Save(p); } } ModelState.Clear(); return(View()); } else { return(View()); } }