protected void Page_Load(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); bulletin = new ArticleWithAthmt(); bulletin = BulletinHelper.GetBulltin(id); } catch { } }
protected void Page_Load(object sender, EventArgs e) { int id = Convert.ToInt32(RouteData.Values["id"]); post = BulletinHelper.GetBulltin(id); //bshare需要抓取的两个内容 Page.Header.Title = post.Title; Page.Header.Description = post.Title; //更新统计数据 using (var db = new SCenterEntities()) { post.ClickCount += 1; db.Attach(post); db.ObjectStateManager.ChangeObjectState(post, System.Data.EntityState.Modified); db.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); } }
/// <summary> /// 创建新的 ArticleWithAthmt 对象。 /// </summary> /// <param name="bid">Bid 属性的初始值。</param> /// <param name="title">Title 属性的初始值。</param> /// <param name="postTime">PostTime 属性的初始值。</param> public static ArticleWithAthmt CreateArticleWithAthmt(global::System.Int64 bid, global::System.String title, global::System.DateTime postTime) { ArticleWithAthmt articleWithAthmt = new ArticleWithAthmt(); articleWithAthmt.Bid = bid; articleWithAthmt.Title = title; articleWithAthmt.PostTime = postTime; return articleWithAthmt; }
/// <summary> /// 用于向 ArticleWithAthmts EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToArticleWithAthmts(ArticleWithAthmt articleWithAthmt) { base.AddObject("ArticleWithAthmts", articleWithAthmt); }