public static BankAccount ToBllModel(Account account)
        {
            if (ReferenceEquals(null, account))
            {
                throw new ArgumentNullException($"{nameof(account)} is null.");
            }

            AccountType type = AccountTypeMapper.ToBllModel(account.Type);

            return(AccountFactory.Create(account.Firstname, account.Lastname, type, account.Id));
        }
Exemple #2
0
 /// <summary>
 /// Maps information from instance of Account from data layer to business layer
 /// </summary>
 /// <param name="account">The data layer account</param>
 /// <returns>The business layer account</returns>
 public static Interface.Entities.Account MapToBusiness(Account account)
 {
     return(new Interface.Entities.Account(
                account.AccountNumber,
                account.AccountOwner.ToString(),
                AccountTypeMapper.GetBusinessAccountType(account.AccountType))
     {
         BonusCount = account.BonusCount,
         CurrentAmount = account.CurrentAmount
     });
 }
Exemple #3
0
 /// <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
     });
 }
Exemple #4
0
 public static Account MapAccountFromDTO(AccountDTO accountDTO)
 {
     if (accountDTO != null)
     {
         return(new Account
         {
             AccountID = accountDTO.AccountID,
             Login = accountDTO.Login,
             Password = accountDTO.Password,
             Balance = accountDTO.Balance,
             FirstName = accountDTO.FirstName,
             LastName = accountDTO.LastName,
             Type = AccountTypeMapper.MapAccountTypeFromDTO(accountDTO.Type)
         });
     }
     else
     {
         throw new ArgumentNullException();
     }
 }
Exemple #5
0
 public static AccountDTO MapAccountToDTO(Account account)
 {
     if (account != null)
     {
         return(new AccountDTO
         {
             AccountID = account.AccountID,
             Login = account.Login,
             Password = account.Password,
             Balance = account.Balance,
             FirstName = account.FirstName,
             LastName = account.LastName,
             Type = AccountTypeMapper.MapAccountTypeToDTO(account.Type)
         });
     }
     else
     {
         throw new ArgumentNullException();
     }
 }