public static int AddArticle(ArticleInfo article) { article.ID = dal.AddArticle(article); UploadBLL.UpdateUpload(TableID, 0, article.ID, Cookies.Admin.GetRandomNumber(false)); if (article.ClassID.IndexOf("|" + 2 + "|") > -1) { CacheHelper.Remove(cacheKey); } FirstArticleDc = null; return(article.ID); }
public async Task <IActionResult> EditArticle(Article article) { _article.AddArticle(article); if (await _article.SaveChangesAsync()) { return(RedirectToAction("Index")); } else { return(View(article)); } }
public ActionResult AddArticle(string Context, string title) { if (!string.IsNullOrEmpty(Context) && !string.IsNullOrEmpty(title)) { Article article = new Article { Title = title, Context = Server.HtmlEncode(Context), }; if (EFArticle.AddArticle(article)) { return(RedirectToAction("ArticleManage")); } } return(View()); }
public static bool AddArticle(Article article) { return(iartitcle.AddArticle(article)); }
public ActionResult <Article> AddArticle([FromBody] Article Article) { return(_article.AddArticle(Article)); }
public virtual void AddArticle() { int art_id; int Article_ID = tools.CheckInt(Request.Form["Article_ID"]); int Article_CateID = tools.CheckInt(Request.Form["article_cate"]); if (Article_CateID == 0) { Article_CateID = tools.CheckInt(Request.Form["article_cate_parent"]); } string Article_Title = tools.CheckStr(Request.Form["Article_Title"]); string Article_Source = tools.CheckStr(Request.Form["Article_Source"]); string Article_Author = tools.CheckStr(Request.Form["Article_Author"]); string Article_Img = tools.CheckStr(Request.Form["Article_Img"]); string Article_Intro = tools.CheckStr(Request.Form["Article_Intro"]); string Article_Content = Request.Form["Article_Content"]; DateTime Article_Addtime = DateTime.Now; int Article_Hits = 0; int Article_IsRecommend = tools.CheckInt(Request.Form["Article_IsRecommend"]); int Article_IsAudit = tools.CheckInt(Request.Form["Article_IsAudit"]); int Article_Sort = tools.CheckInt(Request.Form["Article_Sort"]); string Article_Site = Public.GetCurrentSite(); string Article_Keyword1 = tools.CheckStr(Request.Form["Article_Keyword1"]); string Article_Keyword2 = tools.CheckStr(Request.Form["Article_Keyword2"]); string Article_Keyword3 = tools.CheckStr(Request.Form["Article_Keyword3"]); string Article_Keyword4 = tools.CheckStr(Request.Form["Article_Keyword4"]); string Article_Keyword5 = tools.CheckStr(Request.Form["Article_Keyword5"]); string Article_Keyword = Article_Keyword1 + "|" + Article_Keyword2 + "|" + Article_Keyword3 + "|" + Article_Keyword4 + "|" + Article_Keyword5; if (Article_CateID == 0) { Public.Msg("error", "错误信息", "请选择类别!", false, "{back}"); return; } if (Article_Title == "") { Public.Msg("error", "错误信息", "请填写文章标题", false, "{back}"); return; } ArticleInfo entity = new ArticleInfo(); entity.Article_ID = Article_ID; entity.Article_CateID = Article_CateID; entity.Article_Title = Article_Title; entity.Article_Source = Article_Source; entity.Article_Author = Article_Author; entity.Article_Img = Article_Img; entity.Article_Keyword = Article_Keyword; entity.Article_Intro = Article_Intro; entity.Article_Content = Article_Content; entity.Article_Addtime = Article_Addtime; entity.Article_Hits = Article_Hits; entity.Article_IsRecommend = Article_IsRecommend; entity.Article_IsAudit = Article_IsAudit; entity.Article_Sort = Article_Sort; entity.Article_Site = Article_Site; if (MyBLL.AddArticle(entity, Public.GetUserPrivilege())) { art_id = entity.Article_ID; string[] strkeyword = { Article_Keyword1, Article_Keyword2, Article_Keyword3, Article_Keyword4, Article_Keyword5 }; for (int i = 0; i < strkeyword.Length; i++) { string name = strkeyword[i].ToString(); if (name != "") { Product_Article_LabelInfo entity1 = MyLabel.GetProduct_Article_LabelByName(name); Article_LabelInfo entity3 = new Article_LabelInfo(); if (entity1 == null) { entity1 = new Product_Article_LabelInfo(); entity1.Product_Article_LabelName = name; MyLabel.AddProduct_Article_Label(entity1); int LabelID = 0; Product_Article_LabelInfo entity2 = MyLabel.GetProduct_Article_LabelByTopID(); if (entity2 != null) { LabelID = entity2.Product_Article_LabelID; entity3.Article_Label_LabelID = LabelID; entity3.Article_Label_ArticleID = art_id; MyArt_Label.AddArticle_Label(entity3); } } else { entity3.Article_Label_LabelID = entity1.Product_Article_LabelID; entity3.Article_Label_ArticleID = art_id; MyArt_Label.AddArticle_Label(entity3); } } } Public.Msg("positive", "操作成功", "操作成功", true, "Article_add.aspx"); } else { Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}"); } }
public void AddArticle(Articles article) { iarticle.AddArticle(article); }