public LogLevel Create(LogLevel logLevel) { _context.LogLevels.Add(logLevel); _context.SaveChanges(); return(logLevel); }
public Environment Create(Environment environment) { _context.Environments.Add(environment); _context.SaveChanges(); return(environment); }
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); }
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(); }
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(); }
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(); }