private static void InsertarMultiplesRegistros() { var usuarios = new List <User>() { new User { Name = "lilian", Password = "******", FirstName = "Lilian Estefania", LastName = "Aragon Urias", Email = "lilian@aragon", Status = UserStatus.Active }, new User { Name = "laura", Password = "******", FirstName = "Laura", LastName = "No esta", Email = "laura@sefue", Status = UserStatus.Active } }; usuarios.Add( new User { Name = "luis", Password = "******", FirstName = "Jose Luis", LastName = "Si esta", Email = "jluis@nosefue", Status = UserStatus.Active } ); // Guardar los usuarios creados anteriormente using (var db = new SqliteDbContext()) { db.AddRange(usuarios); db.SaveChanges(); ImprimirUsuarios(); } }
private static void CrearDataGeneral() { using (var db = new SqliteDbContext()) { var roles = new List <Role> { new Role { Name = "Administrador" }, new Role { Name = "Usuario" } }; var permisos = new List <Permission> { new Permission { Description = "Puede iniciar sesión", Level = PermissionLevel.TotalAccess }, new Permission { Description = "Puede cobrar", Level = PermissionLevel.RestrictedAccess } }; db.AddRange( new RolePermission { Role = roles[0], Permission = permisos[0] }, new RolePermission { Role = roles[0], Permission = permisos[1] }, new RolePermission { Role = roles[1], Permission = permisos[1] } ); db.SaveChanges(); var usuarios = new List <User> { new User { Name = "bidkar", Password = "******", FirstName = "Bidkar", LastName = "Aragon", Email = "bidkar@aragon", Role = roles[0] }, new User { Name = "citlalli", Password = "******", FirstName = "Citalli", LastName = "Rivera", Email = "citlalli@rivera", Role = roles[1] } }; db.AddRange(usuarios); db.SaveChanges(); } }