Esempio n. 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;
        }
Esempio n. 2
0
 partial void DeletePost(Post instance);
Esempio n. 3
0
 partial void InsertPost(Post instance);
Esempio n. 4
0
 partial void UpdatePost(Post instance);
Esempio n. 5
0
		private void detach_Posts(Post entity)
		{
			this.SendPropertyChanging();
			entity.Blog = null;
		}
Esempio n. 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);
 }
Esempio n. 9
0
 public Post Add(Post newPost)
 {
     _posts.Add(newPost);
     newPost.Id = _posts.Max(p => p.Id) + 1;
     return(newPost);
 }