public BogPost Update(BogPost blogPostChanges) { var blogPost = context.BlogPosts.Attach(blogPostChanges); blogPost.State = Microsoft.EntityFrameworkCore.EntityState.Modified; context.SaveChanges(); return(blogPostChanges); }
public BogPost Delete(int id) { BogPost bogPost = context.BlogPosts.Find(id); if (bogPost != null) { context.BlogPosts.Remove(bogPost); context.SaveChanges(); } return(bogPost); }
public BogPost Creat(BogPost bogPost) { context.BlogPosts.Add(bogPost); context.SaveChanges(); return(bogPost); }