void addBankAccoutns(BankingContext context) { var customers = from c in context.Customers select c; List <BankAccount> accounts = new List <BankAccount>(); foreach (Customer c in customers) { BankAccount account = new BankAccount { CustomerId = c.CustomerId, Number = Funciones.CreateUnique16DigitString(), Balance = 1000, IsLocked = false }; BankAccount account2 = new BankAccount { CustomerId = c.CustomerId, Number = Funciones.CreateUnique16DigitString(), Balance = 1000, IsLocked = false }; BankAccount account3 = new BankAccount { CustomerId = c.CustomerId, Number = Funciones.CreateUnique16DigitString(), Balance = 1000, IsLocked = false }; accounts.Add(account); accounts.Add(account2); accounts.Add(account3); } foreach (BankAccount a in accounts) { context.BankAccounts.Add(a); } context.SaveChanges(); }
static void AddCustomers(BankingContext context) { context.Customers.Add(new Customer { Dni = "00132652", FirstName = "Cesar", LastName = "Paredes", Email = "*****@*****.**", Phone = "994883037", Password = Funciones.GetPassword(8) }); context.Customers.Add(new Customer { Dni = "00152249", FirstName = "Erick", LastName = "Esquivel", Email = "*****@*****.**", Phone = "987009041", Password = Funciones.GetPassword(8) }); context.Customers.Add(new Customer { Dni = "00136621", FirstName = "Omar", LastName = "Adrianzen", Email = "*****@*****.**", Phone = "940547032", Password = Funciones.GetPassword(8) }); context.Customers.Add(new Customer { Dni = "00130667", FirstName = "Rodrigo", LastName = "Cuba", Email = "*****@*****.**", Phone = "940547032", Password = Funciones.GetPassword(8) }); context.Customers.Add(new Customer { Dni = "00134612", FirstName = "Rolando", LastName = "Felix", Email = "*****@*****.**", Phone = "961000904", Password = Funciones.GetPassword(8) }); context.Customers.Add(new Customer { Dni = "00133656", FirstName = "Kevin", LastName = "Ontaneda", Email = "*****@*****.**", Phone = "979738935", Password = Funciones.GetPassword(8) }); context.Customers.Add(new Customer { Dni = "00128624", FirstName = "Giancarlo", LastName = "Pujulla", Email = "*****@*****.**", Phone = "997202764", Password = Funciones.GetPassword(8) }); context.Customers.Add(new Customer { Dni = "00135677", FirstName = "Alejandro", LastName = "Camarena", Email = "*****@*****.**", Phone = "997071343", Password = Funciones.GetPassword(8) }); context.Customers.Add(new Customer { Dni = "00140636", FirstName = "Adrian", LastName = "Talavera", Email = "*****@*****.**", Phone = "987416998", Password = Funciones.GetPassword(8) }); context.Customers.Add(new Customer { Dni = "00128648", FirstName = "Pierina", LastName = "Castro", Email = "*****@*****.**", Phone = "942535619", Password = Funciones.GetPassword(8) }); context.SaveChanges(); }
void addOperations(BankingContext context) { var Operations = from c in context.Operations select c; if (Operations.Any()) { return; } context.Operations.Add(new Operation { Name = "Transferencia" }); context.SaveChanges(); }
public void RunMigrations() { using (var context = new BankingContext(Funciones.GetConnectionString())) { var customers = from c in context.Customers select c; if (customers.Any()) { return; } addOperations(context); AddCustomers(context); addBankAccoutns(context); } }