public ActionResult Create([Bind(Include = "ArticleId,Title,Content,Thumbnail,CreatedDate,ViewsCount,CommentsCount,SeoAuthor,SeoDescription,SeoTags")] Articles articles, HttpPostedFileBase Thumbnail) { if (ModelState.IsValid) { articles.CreatedDate = DateTime.Now; articles.Slug = Kullanici.GetFriendlyTitle(articles.Title); articles.ViewsCount = 1; articles.CommentsCount = 0; articles.UpdateDate = DateTime.Now; if (articles.Thumbnail != null) { string fileName = articles.Slug + Path.GetExtension(Kullanici.GetFriendlyTitle(Thumbnail.FileName)); try { string path = Path.Combine(Server.MapPath("~/UploadedFiles"), fileName); Thumbnail.SaveAs(path); articles.Thumbnail = fileName; } catch (Exception) { articles.Thumbnail = "resim-yok.jpg"; } } db.Articles.Add(articles); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ArticleId = new SelectList(db.Articles, "ArticleId", "Title", articles.ArticleId); ViewBag.ArticleId = new SelectList(db.Articles, "ArticleId", "Title", articles.ArticleId); return(View(articles)); }