public static Post CreatePost(string title, string postContent) { Post newPost = new Post(); newPost.PostTitle = title; newPost.PostContent = postContent; newPost.PostDate = DateTime.Now; CSCB766BlogDBEntities blogDB = new CSCB766BlogDBEntities(); blogDB.Posts.AddObject(newPost); blogDB.SaveChanges(); return newPost; }
partial void DeletePost(Post instance);
partial void InsertPost(Post instance);
partial void UpdatePost(Post instance);
private void detach_Posts(Post entity) { this.SendPropertyChanging(); entity.Blog = null; }
private void attach_Posts(Post entity) { this.SendPropertyChanging(); entity.Blog = this; }
/// <summary> /// Create a new Post object. /// </summary> /// <param name="postID">Initial value of the PostID property.</param> /// <param name="postContent">Initial value of the PostContent property.</param> /// <param name="postTitle">Initial value of the PostTitle property.</param> public static Post CreatePost(global::System.Int32 postID, global::System.String postContent, global::System.String postTitle) { Post post = new Post(); post.PostID = postID; post.PostContent = postContent; post.PostTitle = postTitle; return post; }
/// <summary> /// Deprecated Method for adding a new object to the Posts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPosts(Post post) { base.AddObject("Posts", post); }
public Post Add(Post newPost) { _posts.Add(newPost); newPost.Id = _posts.Max(p => p.Id) + 1; return(newPost); }