Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public List <BankAccountModel> getByCustomerID(string OwnerCustomerID)
        {
            BankAccountRepository repository = new BankAccountRepository(this._context);

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

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

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