public BlogPost UpdateBlogPost(BlogPost post) { using (BlogContext context = new BlogContext()) { context.Entry(post).State = EntityState.Modified; context.SaveChanges(); } return post; }
public BlogPost CreateBlogPost(BlogPost post) { using (BlogContext context = new BlogContext()) { context.BlogPosts.Add(post); context.SaveChanges(); } return post; }