示例#1
0
        public User Save(User user)
        {
            var state = user.id == 0 ? EntityState.Added : EntityState.Modified;

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

            _context.Entry(log).State = state;
            _context.SaveChanges();
            return(log);
        }