public ActionResult ArticlesAdd(HttpPostedFileBase Image, bool chkPublish, ArticlesTable articleTable) { var seoMake = Seo.Translate(articleTable.ArticleTitle); string filePath = "content-icon.png"; int publishId = 0; if (Image != null) { filePath = Path.GetFileName(Image.FileName); filePath = seoMake + ".jpg"; var uploadPath = Path.Combine(Server.MapPath("~/Content/Images/"), filePath); Image.SaveAs(uploadPath); } if (chkPublish == true) { publishId = 1; } _modelArticle.AddArticleData(articleTable.ArticleTitle, articleTable.ArticleAuthor, articleTable.ArticleContent, articleTable.ArticleTags, DateTime.Now, seoMake, publishId, filePath); return RedirectToAction("Index", "AdmArticles"); }
public ModelArticle() { _articlesContext = new MyWebContext(); _articlesTable = new ArticlesTable(); }