public void Show() { var accountHolder = new AccountHolder { FullName = "Ileana Scândură" }; var account = new DebitAccount { AccountHolder = accountHolder, Iban = "RO29RZBR2617696727494934" }; accountHolder.DebitAccounts.Add(account); dataRepository.Insert(accountHolder); account.Deposit(100); unitOfWork.Commit(); accountHolder = dataRepository.Query <AccountHolder>() .Single(ah => ah.Id == accountHolder.Id); System.Console.WriteLine("Debit accounts of {0}:", accountHolder.FullName); foreach (var debitAccount in accountHolder.DebitAccounts) { System.Console.WriteLine("IBAN: {0}, Amount: {1}", debitAccount.Iban, debitAccount.Amount); } }
public void Show() { var accountHolder = new Customer { FirstName = "Ileana", LastName = "Scândură", IdNo = "091203923018", Id = Guid.NewGuid() }; var debitAccount = new DebitAccount { AccountHolderId = accountHolder.Id, Iban = "RO29RZBR2617696727494944" }; var savingsAccount = new SavingsAccount { AccountHolderId = accountHolder.Id, Iban = "RO29RZBR2617696727494946" }; accountHolder.DebitAccounts.Add(debitAccount); accountHolder.SavingsAccounts.Add(savingsAccount); dataRepository.Insert(accountHolder); debitAccount.Deposit(100); unitOfWork.Commit(); System.Console.WriteLine("Debit accounts of {0}:", accountHolder.FullName); foreach (var da in accountHolder.DebitAccounts) { System.Console.WriteLine("IBAN: {0}, Amount: {1}", da.Iban, da.Amount); } }