public void Create_Complex_Account2() { PersonRepository context = new PersonRepository(); Person person = PersonTest.CreatePerson(); Customer customer = PersonTest.CreateCustomer(person); Lawyer lawyer = PersonTest.CreateLawyer(person); if (person != null) { context.Add(person); } /* GeneralAccount generalAccount = CreateGeneralAccount(); * IndexAccount indexAccount = CreateIndexAccount(); * Account account = CreateAccount(); * indexAccount.Accounts.Add(account); * generalAccount.IndexAccounts.Add(indexAccount); * context.Add(generalAccount); * CustomerRepository customerRepository = new CustomerRepository(); * customer.Accounts.Add(account); * customerRepository.Add(customer); * LawyerRepository lawyerRepository = new LawyerRepository(); * lawyer.Accounts.Add(account); * lawyerRepository.Add(lawyer);*/ }
public void Create_Complex_Account() { var context = new ValiasrContext("Valiasr"); Person person = PersonTest.CreatePerson(); Customer customer = PersonTest.CreateCustomer(person); Lawyer lawyer = PersonTest.CreateLawyer(person); IndexAccount indexAccount = CreateIndexAccount(); GeneralAccount generalAccount = CreateGeneralAccount(); Account account = CreateAccount(); account.Lawyers = new Collection <Lawyer>(); account.Lawyers.Add(lawyer); account.Customers = new Collection <Customer>(); account.Customers.Add(customer); LoanRequest loanRequest = new LoanRequest(); Loan loan = new Loan(); // loan.Account = account; loan.LoanRequest = loanRequest; LoanRequestOkyAssistant loanRequestOkyAssistant = new LoanRequestOkyAssistant(); loanRequest.LoanRequestOkyAsistant = loanRequestOkyAssistant; loanRequest.Account = account; account.LoanRequests = new Collection <LoanRequest>(); account.LoanRequests.Add(loanRequest); indexAccount.BankAccounts = new Collection <BankAccount>(); indexAccount.BankAccounts.Add(account); indexAccount.BankAccounts.Add(loan); generalAccount.IndexAccounts = new Collection <IndexAccount>(); generalAccount.IndexAccounts.Add(indexAccount); context.GeneralAccounts.Add(generalAccount); //context.IndexAccounts.Add(indexAccount); context.SaveChanges(); /* GeneralAccount generalAccount = CreateGeneralAccount(); * * * * account.Lawyers.Add(lawyer); * indexAccount.Accounts.Add(account); * generalAccount.IndexAccounts.Add(indexAccount); * * context.GeneralAccounts.Add(generalAccount); * account.Customers.Add(customer); * context.SaveChanges();*/ }
public void Create_Complex_Account1() { GeneralAccountRepository context = new GeneralAccountRepository(); Person person = PersonTest.CreatePerson(); // Customer customer = PersonTest.CreateCustomer(person); Lawyer lawyer = PersonTest.CreateLawyer(person); GeneralAccount generalAccount = CreateGeneralAccount(); IndexAccount indexAccount = CreateIndexAccount(); Account account = CreateAccount(); // account.Customers.Add(customer); account.Lawyers.Add(lawyer); indexAccount.BankAccounts.Add(account); generalAccount.IndexAccounts.Add(indexAccount); context.Add(generalAccount); //context.AddIndexAccount(indexAccount); //context.GeneralAccounts.Add(generalAccount); // context.SaveChanges(); }