/// <summary> /// Opens new account with given information /// </summary> /// <param name="accountOwner">The owner of the account</param> /// <param name="accountType">The account type</param> /// <param name="numberCreateService">Service for creating unique account number</param> public void OpenAccount(string accountOwner, Interface.Entities.AccountType accountType, IAccountNumberCreateService numberCreateService) { string accountNumber = numberCreateService.GetNumber(); Interface.Entities.Account account = new Interface.Entities.Account(accountNumber, accountOwner, accountType); _repository.OpenAccount(AccountMapper.MapToData(account)); }
/// <summary> /// Maps information from instance of Account from business layer to data layer /// </summary> /// <param name="account">The business layer account</param> /// <returns>The data layer account</returns> public static Account MapToData(Interface.Entities.Account account) { return(new Account( account.AccountNumber, ParseOwner(account.AccountOwner), AccountTypeMapper.GetDataAccountType(account.AccountType)) { BonusCount = account.BonusCount, CurrentAmount = account.CurrentAmount }); }