示例#1
0
        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;
        }
示例#2
0
 partial void DeletePost(Post instance);
示例#3
0
 partial void InsertPost(Post instance);
示例#4
0
 partial void UpdatePost(Post instance);
示例#5
0
		private void detach_Posts(Post entity)
		{
			this.SendPropertyChanging();
			entity.Blog = null;
		}
示例#6
0
		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&lt;T&gt; property instead.
 /// </summary>
 public void AddToPosts(Post post)
 {
     base.AddObject("Posts", post);
 }
示例#9
0
 public Post Add(Post newPost)
 {
     _posts.Add(newPost);
     newPost.Id = _posts.Max(p => p.Id) + 1;
     return(newPost);
 }