예제 #1
0
        public BlogPost UpdateBlogPost(BlogPost post)
        {
            using (BlogContext context = new BlogContext())
            {
                context.Entry(post).State = EntityState.Modified;
                context.SaveChanges();
            }

            return post;
        }
예제 #2
0
        public BlogPost CreateBlogPost(BlogPost post)
        {
            using (BlogContext context = new BlogContext())
            {
                context.BlogPosts.Add(post);
                context.SaveChanges();
            }

            return post;
        }