public User Save(User user) { var state = user.id == 0 ? EntityState.Added : EntityState.Modified; _context.Entry(user).State = state; _context.SaveChanges(); return(user); }
public Log Save(Log log) { var state = log.id == 0 ? EntityState.Added : EntityState.Modified; _context.Entry(log).State = state; _context.SaveChanges(); return(log); }