/// <summary> /// Create a new PostThread object. /// </summary> /// <param name="postID">Initial value of the PostID property.</param> public static PostThread CreatePostThread(global::System.Int32 postID) { PostThread postThread = new PostThread(); postThread.PostID = postID; return(postThread); }
public void DeletePost(PostThread post) { using (ForumDBContext dc = conn.GetContext()) { dc.PostThreads.DeleteObject(dc.PostThreads.Where (ac => ac.PostID.Equals(post.PostID)).FirstOrDefault()); dc.SaveChanges(); } }
public PostThread GetPostByID(int PostID) { PostThread post = null; using (ForumDBContext dc = conn.GetContext()) { post = (from a in dc.PostThreads where a.PostID == PostID select a).FirstOrDefault(); } return(post); }
public PostThread SavePost(PostThread post) { using (ForumDBContext dc = conn.GetContext()) { if (post.PostID > 0) { dc.PostThreads.Attach(new PostThread { PostID = post.PostID }); dc.PostThreads.ApplyCurrentValues(post); } else { dc.PostThreads.AddObject(post); } dc.SaveChanges(); } return(post); }
/// <summary> /// Deprecated Method for adding a new object to the PostThreads EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPostThreads(PostThread postThread) { base.AddObject("PostThreads", postThread); }