コード例 #1
0
ファイル: Seeder.cs プロジェクト: GeorgiBarbutov/SoftUni
        private static void SeedUsers(BillsPaymentSystemContext context)
        {
            User[] users = new User[]
            {
                new User()
                {
                    //UserId = 1,
                    FirstName = "Purvan",
                    LastName  = "Purvanov",
                    Email     = "*****@*****.**",
                    Password  = "******",
                },

                new User()
                {
                    //UserId = 2,
                    FirstName = "Vtoran",
                    LastName  = "Vtoranov",
                    Email     = "*****@*****.**",
                    Password  = "******",
                }
            };

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

            context.SaveChanges();
        }
コード例 #2
0
ファイル: Seeder.cs プロジェクト: GeorgiBarbutov/SoftUni
        private static void SeedCredicCards(BillsPaymentSystemContext context)
        {
            CreditCard[] creditCards = new CreditCard[]
            {
                new CreditCard()
                {
                    //CreditCardId = 1,
                    ExpirationDate = DateTime.Now,
                },

                new CreditCard()
                {
                    //CreditCardId = 2,
                    ExpirationDate = DateTime.Today,
                }
            };

            creditCards[0].Deposit(1000.0m);
            creditCards[1].Deposit(1000.0m);

            foreach (var creditCard in creditCards)
            {
                if (IsValid(creditCard))
                {
                    context.Add(creditCard);
                }
            }

            context.SaveChanges();
        }
コード例 #3
0
ファイル: Seeder.cs プロジェクト: GeorgiBarbutov/SoftUni
        private static void SeedPaymentMethods(BillsPaymentSystemContext context)
        {
            PaymentMethod[] paymentMethods = new PaymentMethod[]
            {
                new PaymentMethod()
                {
                    //Id = 1,
                    Type          = Data.Models.Enums.Type.BankAccount,
                    BankAccountId = 1,
                    CreditCardId  = null,
                    UserId        = 1
                },

                new PaymentMethod()
                {
                    //Id = 2,
                    Type          = Data.Models.Enums.Type.CreditCard,
                    BankAccountId = null,
                    CreditCardId  = 1,
                    UserId        = 2
                }
            };

            foreach (var paymentMethod in paymentMethods)
            {
                if (IsValid(paymentMethod))
                {
                    context.Add(paymentMethod);
                }
            }

            context.SaveChanges();
        }
コード例 #4
0
ファイル: Seeder.cs プロジェクト: GeorgiBarbutov/SoftUni
        private static void SeedBankAccounts(BillsPaymentSystemContext context)
        {
            BankAccount[] bankAccounts = new BankAccount[]
            {
                new BankAccount()
                {
                    //BankAccountId = 1,
                    BankName  = "Na Barbuta Bankata",
                    SWIFTCode = "111222111"
                },

                new BankAccount()
                {
                    //BankAccountId = 2,
                    BankName  = "Na Barbuta Bankata",
                    SWIFTCode = "222111222"
                }
            };

            bankAccounts[0].Deposit(1000.0m);
            bankAccounts[1].Deposit(5000.0m);

            foreach (var bankAccount in bankAccounts)
            {
                if (IsValid(bankAccount))
                {
                    context.Add(bankAccount);
                }
            }

            context.SaveChanges();
        }