コード例 #1
0
        public LogLevel Create(LogLevel logLevel)
        {
            _context.LogLevels.Add(logLevel);
            _context.SaveChanges();

            return(logLevel);
        }
コード例 #2
0
        public Environment Create(Environment environment)
        {
            _context.Environments.Add(environment);
            _context.SaveChanges();

            return(environment);
        }
コード例 #3
0
        public User Save(User user)
        {
            var state = user.id == 0 ? EntityState.Added : EntityState.Modified;

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

            _context.Entry(log).State = state;
            _context.SaveChanges();
            return(log);
        }
コード例 #5
0
        public void Populate()
        {
            if (_context.Environments.Any())
            {
                return;
            }

            Environment env1 = new Environment
            {
                description = "Desenvolvimento",
                shortName   = "dev"
            };
            Environment env2 = new Environment
            {
                description = "Homologação",
                shortName   = "homolog"
            };
            Environment env3 = new Environment
            {
                description = "Produção",
                shortName   = "prod"
            };

            _context.Environments.AddRange(env1, env2, env3);
            _context.SaveChanges();
        }
コード例 #6
0
        public void Populate()
        {
            if (_context.LogLevels.Any())
            {
                return;
            }

            LogLevel lvl1 = new LogLevel
            {
                description = "error"
            };
            LogLevel lvl2 = new LogLevel
            {
                description = "warning"
            };
            LogLevel lvl3 = new LogLevel
            {
                description = "debug"
            };
            LogLevel lvl4 = new LogLevel
            {
                description = "info"
            };

            _context.LogLevels.AddRange(lvl1, lvl2, lvl3, lvl4);
            _context.SaveChanges();
        }
コード例 #7
0
        public void Populate()
        {
            if (_context.Users.Any())
            {
                return;
            }

            User u1 = new User
            {
                name     = "Lucas",
                role     = "admin",
                email    = "*****@*****.**",
                password = "******",
                cpf      = "20735259038"
            };

            _context.Users.Add(u1);
            _context.SaveChanges();
        }