public static BankAccount ToBankAccount(DalBankAccount dalBankAccount) { BankAccount bankAccount; switch (dalBankAccount.AccountType) { case AccountType.Base: { bankAccount = new BaseAccount(AccountOwnersMapper.ToAccountOwner(dalBankAccount.AccountOwner), dalBankAccount.BankAccountNumber, dalBankAccount.InvoiceAmount, dalBankAccount.BonusScores, dalBankAccount.IsClosed); } break; case AccountType.Platinum: { bankAccount = new PlatinumAccount(AccountOwnersMapper.ToAccountOwner(dalBankAccount.AccountOwner), dalBankAccount.BankAccountNumber, dalBankAccount.InvoiceAmount, dalBankAccount.BonusScores, dalBankAccount.IsClosed); } break; case AccountType.Gold: { bankAccount = new GoldAccount(AccountOwnersMapper.ToAccountOwner(dalBankAccount.AccountOwner), dalBankAccount.BankAccountNumber, dalBankAccount.InvoiceAmount, dalBankAccount.BonusScores, dalBankAccount.IsClosed); } break; default: { bankAccount = new BaseAccount(AccountOwnersMapper.ToAccountOwner(dalBankAccount.AccountOwner), dalBankAccount.BankAccountNumber, dalBankAccount.InvoiceAmount, dalBankAccount.BonusScores, dalBankAccount.IsClosed); } break; } return(bankAccount); }
public static DalBankAccount ToDalBankAccount(BankAccount bankAccount, AccountType accountType) { DalBankAccount dalBankAccount = new DalBankAccount(); dalBankAccount.AccountOwner = AccountOwnersMapper.ToDalAccountOwner(bankAccount.Owner); dalBankAccount.AccountType = accountType; dalBankAccount.BankAccountNumber = bankAccount.AccountID; dalBankAccount.BonusScores = bankAccount.BonuseScores; dalBankAccount.InvoiceAmount = bankAccount.InvoiceAmount; dalBankAccount.IsClosed = bankAccount.IsClosed; return(dalBankAccount); }