public ActionResult Create([Bind(Include = "ArticleId,CategoryId,Baslik,ImageUrl,ImageUrlt,Description,Date,Reads,Labels,UserId")] Article article, FormCollection form, string editor1, string etiket, IEnumerable <HttpPostedFileBase> files, HttpPostedFileBase file0, HttpPostedFileBase file1) { if (ModelState.IsValid) { ImageUpload imageUpload = new ImageUpload(); article.Date = DateTime.Now; string sightlist = form["sightlist"]; if (files.ElementAt(1) != null && files.ElementAt(0) != null) { file0 = files.ElementAt(0); file1 = files.ElementAt(1); article.ImageUrl = imageUpload.ImageResizeFirst(file0, 240, 240); article.ImageUrlt = imageUpload.ImageResizeSecond(file1, 100, 200);; } else if (files.ElementAt(0) != null) { file0 = files.ElementAt(0); article.ImageUrl = imageUpload.ImageResizeFirst(file0, 240, 240); } else if (files.ElementAt(1) != null) { file1 = files.ElementAt(1); article.ImageUrlt = imageUpload.ImageResizeSecond(file1, 240, 240); } var karma = ""; if (etiket == "" && sightlist == null) { article.Labels.Clear(); } else if (sightlist != null && sightlist != "") { string[] etiketdizi = sightlist.Split(','); foreach (var item in etiketdizi) { var gecen = db.Labels.Find((Convert.ToInt32(item))); if (item == "") { continue; } else { karma = karma + gecen.LabelName + ","; } } karma = karma + etiket; } if (karma != null && karma != "") { string[] etiketdizi = karma.Split(','); foreach (var item in etiketdizi) { if (item == "") { continue; } if (db.Labels.Any(p => p.LabelName.Equals(item))) { var gecen = db.Labels.Where(p => p.LabelName.Equals(item)).First().LabelId; article.Labels.Add(db.Labels.Find(gecen)); } else { var yenietikets = new Labels { LabelName = item }; if (yenietikets.ToString().Length <= 50) { article.Labels.Add(yenietikets); } } } } else { string[] etiketdizi = etiket.Split(','); foreach (var item in etiketdizi) { if (item == "") { continue; } else if (db.Labels.Any(p => p.LabelName.Equals(item))) { var gecen = db.Labels.Where(p => p.LabelName.Equals(item)).First().LabelId; article.Labels.Add(db.Labels.Find(gecen)); } else { var yenietikets = new Labels { LabelName = item }; if (yenietikets.ToString().Length <= 50) { article.Labels.Add(yenietikets); } } } karma = karma + etiket; } article.Description = editor1; ViewBag.etiket = etiket; db.Article.Add(article); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Category, "CategoryId", "CategoryName", article.CategoryId); return(View(article)); }