public ActionResult AddReference(References newmodel, HttpPostedFileBase uploadfile, IEnumerable <HttpPostedFileBase> attachments, string language) { var languages = LanguageManager.GetLanguages(); var list = new SelectList(languages, "Culture", "Language"); ViewBag.LanguageList = list; if (ModelState.IsValid) { if (Session["ModifiedImageId"] != null) { newmodel.Logo = "/Content/images/userfiles/news/" + Session["ModifiedImageId"].ToString() + Session["WorkingImageExtension"].ToString(); ImageHelperNew.DestroyImageCashAndSession(0, 0); } else { newmodel.Logo = "/Content/images/front/noimage.jpeg"; } //if (uploadfile != null && uploadfile.ContentLength > 0) //{ // Random random = new Random(); // int rand = random.Next(1000, 99999999); // new ImageHelper(240, 240).SaveThumbnail(uploadfile,"/Content/images/references/", Utility.SetPagePlug(newmodel.ReferenceName) + "_" + rand + Path.GetExtension(uploadfile.FileName)); // newmodel.Logo = "/Content/images/references/" + Utility.SetPagePlug(newmodel.ReferenceName) + "_" + rand + Path.GetExtension(uploadfile.FileName); //} //else //{ // newmodel.Logo = "/Content/images/front/noimage.jpeg"; //} newmodel.Language = language; newmodel.SortOrder = 9999; newmodel.TimeCreated = DateTime.Now; ViewBag.ProcessMessage = ReferenceManager.AddReference(newmodel); //foreach (var item in attachments) //{ // if (item != null && item.ContentLength > 0) // { // item.SaveAs(Server.MapPath("/Content/images/userfiles/")+item.FileName); // Random random = new Random(); // int rand = random.Next(1000, 99999999); // string path = Utility.SetPagePlug(newmodel.ReferenceName) + "_" + rand + Path.GetExtension(item.FileName); // new ImageHelper(1020, 768).SaveThumbnail(item, "/Content/images/userfiles/", path); // rand = random.Next(1000, 99999999); // string thumbnail = Utility.SetPagePlug(newmodel.ReferenceName) + "_" + rand + Path.GetExtension(item.FileName); // // Image img = Image.FromFile(Server.MapPath("/Content/images/userfiles/") + item.FileName); // Bitmap bmp = new Bitmap(Server.MapPath("/Content/images/userfiles/") + item.FileName); // Bitmap bmp2 = new Bitmap(bmp); // using (Bitmap Orgbmp = bmp2) // { // int sabit = 90; // Size Boyut = new Size(210, 125); // Bitmap ReSizedThmb = new Bitmap(Orgbmp, Boyut); // ReSizedThmb.Save(Server.MapPath("/Content/images/userfiles/")+thumbnail); // bmp.Dispose(); // bmp2.Dispose(); // Orgbmp.Dispose(); // GC.Collect(); // } // //new ImageHelper(300, 280).ResizeFromStream("/Content/images/userfiles/",thumbnail,img); // Photo p = new Photo(); // p.CategoryId = (int)PhotoType.Reference; // p.ItemId = newmodel.ReferenceId; // p.Path = "/Content/images/userfiles/" + path; // p.Thumbnail = "/Content/images/userfiles/" + thumbnail; // p.Online = true; // p.SortOrder = 9999; // p.Language = language; // p.TimeCreated = DateTime.Now; // p.Title = newmodel.ReferenceName; // PhotoManager.Save(p); // } //} ModelState.Clear(); // Response.Redirect("/yonetim/haberduzenle/" + newsmodel.NewsId); return(View()); } else { return(View()); } }