Пример #1
0
 public static void Seed(BillsPaymentSystemContext context)
 {
     InsertValues(UsersInitializer.GetUsers(), context);
     InsertValues(CreditCardInitializer.GetCreditCards(), context);
     InsertValues(BankAccountInitializer.GetBankAccounts(), context);
     InsertValues(PaymentMethodInitializer.GetPaymentMethods(), context);
 }
        private static void InsertUsers(BillsPaymentSystemContext context)
        {
            var users = UsersInitializer.GetUsers();

            foreach (User user in users)
            {
                if (IsValid(user))
                {
                    context.Users.Add(user);
                }
            }

            context.SaveChanges();
        }