/// <summary> /// 新建文章 /// </summary> /// <param name="article"></param> /// <returns></returns> public static bool InsertNewArticle(Article article) { bool result = false; lock (mLockObj) { mdb.Connect(); result = ArticleData.InsertArticle(article, mdb.GetConn); mdb.Disconnect(); } return(result); }
protected void Button1_Click(object sender, EventArgs e) { var objArticle = new Article(); objArticle.CategoryId = 1; objArticle.Title = "Web Title"; objArticle.Body = "Web Article body here"; objArticle.PublishDate = DateTime.Now; ArticleData objArticleData = new ArticleData(); objArticleData.InsertArticle(objArticle); }