Beispiel #1
0
        public BankAccountModel createAccount(string CustomerName, string CustomerID, string AccountNumber, float InitialBalance)
        {
            BankAccountRepository repository = new BankAccountRepository(this._context);

            var account = repository.getByAccountNumber(AccountNumber);

            if (account != null)
            {
                throw new Exception("there's another bank account with this Bank Number.");
            }

            account = repository.createAccount(CustomerName, CustomerID, AccountNumber, InitialBalance);
            return(BanckAccountMapper.toModel(account));
        }
Beispiel #2
0
        public List <BankAccountModel> getByCustomerID(string OwnerCustomerID)
        {
            BankAccountRepository repository = new BankAccountRepository(this._context);

            return(repository.getByCustomerID(OwnerCustomerID).Select(a => BanckAccountMapper.toModel(a)).ToList());
        }
Beispiel #3
0
        public BankAccountModel getByAccountToken(Guid token)
        {
            BankAccountRepository repository = new BankAccountRepository(this._context);

            return(BanckAccountMapper.toModel(repository.getByAccountToken(token)));
        }
Beispiel #4
0
        public BankAccountModel getByAccountNumber(string AccountNumber)
        {
            BankAccountRepository repository = new BankAccountRepository(this._context);

            return(BanckAccountMapper.toModel(repository.getByAccountNumber(AccountNumber)));
        }