public Blog Update(Blog blog, object key) { if (blog == null) { return(null); } Blog exist = _context.Blogs.Find(key); if (exist != null) { _context.Entry(exist).CurrentValues.SetValues(blog); _context.SaveChanges(); } return(exist); }
public Post Update(Post post, object key) { if (post == null) { return(null); } Post exist = _context.Posts.Find(key); if (exist != null) { _context.Entry(exist).CurrentValues.SetValues(post); _context.SaveChanges(); } return(exist); }