コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     odsmodel = new ObjectDataSourceModel();
     try
     {
         if (Page.RouteData.Values["PostID"].ToString() != null)
         {
             int postid;
             int.TryParse(Page.RouteData.Values["PostID"].ToString(), out postid);
             post = odsmodel.GetSinglePost(postid);
             postName.Text = post.Title;
             postdetails.Text = post.PostText;
             this.Page.Title = "My .Ramblings - " + post.Title;
         }
         else
         {
             Response.Redirect("~/");
         }
     }
     catch
     {
         Response.Redirect("~/");
     }
 }
コード例 #2
0
 /// <summary>
 /// Create a new Post object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 public static Post CreatePost(global::System.Int32 id)
 {
     Post post = new Post();
     post.ID = id;
     return post;
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Posts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPosts(Post post)
 {
     base.AddObject("Posts", post);
 }