コード例 #1
0
ファイル: BlogDAL.cs プロジェクト: nvankov/FirstBlogSystem
        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
ファイル: Blog.designer.cs プロジェクト: eouw0o83hf/Blog
 partial void DeletePost(Post instance);
コード例 #3
0
ファイル: Blog.designer.cs プロジェクト: eouw0o83hf/Blog
 partial void InsertPost(Post instance);
コード例 #4
0
ファイル: Blog.designer.cs プロジェクト: eouw0o83hf/Blog
 partial void UpdatePost(Post instance);
コード例 #5
0
ファイル: Blog.designer.cs プロジェクト: eouw0o83hf/Blog
		private void detach_Posts(Post entity)
		{
			this.SendPropertyChanging();
			entity.Blog = null;
		}
コード例 #6
0
ファイル: Blog.designer.cs プロジェクト: eouw0o83hf/Blog
		private void attach_Posts(Post entity)
		{
			this.SendPropertyChanging();
			entity.Blog = this;
		}
コード例 #7
0
 /// <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;
 }
コード例 #8
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);
 }
コード例 #9
0
 public Post Add(Post newPost)
 {
     _posts.Add(newPost);
     newPost.Id = _posts.Max(p => p.Id) + 1;
     return(newPost);
 }