public void DeleteBlogPost(int id) { using (BlogPostContext context = new BlogPostContext(_connectionName, _schemaName)) { Data.Model.BlogPost post = context.BlogPosts.Find(id); context.Entry(post).State = System.Data.EntityState.Deleted; context.SaveChanges(); } }
public void UpdateBlogPost(Domain.Model.BlogPost post) { using (BlogPostContext context = new BlogPostContext(_connectionName, _schemaName)) { context.Entry(new Data.Model.BlogPost { Id = post.Id, Post = post.Post, Title = post.Title }).State = System.Data.EntityState.Modified; context.SaveChanges(); } }