Exemplo n.º 1
0
        public bool Update(ClientBankAccountDetailsVM account)
        {
            var  clientRepo    = new ClientRepo(_context);
            bool clientSuccess = clientRepo.Update(account.ClientID, account.FirstName, account.LastName);

            var  bankAccountRepo    = new BankAccountRepo(_context);
            bool bankAccountSuccess = bankAccountRepo.Update(account.AccountNum, account.Balance);

            return(clientSuccess && bankAccountSuccess);
        }
Exemplo n.º 2
0
        public ClientBankAccountDetailsVM Create(string accountType, decimal balance, string firstName, string lastName, string email)
        {
            // @TODO handle partial creation
            var clientRepo = new ClientRepo(_context);
            var client     = clientRepo.Create(email, firstName, lastName);

            var bankAccountRepo = new BankAccountRepo(_context);
            var bankAccount     = bankAccountRepo.Create(accountType, balance);

            if (client == null || bankAccount == null)
            {
                return(null);
            }

            var clientBankAccount = new ClientAccount()
            {
                AccountNum = bankAccount.AccountNum, ClientID = client.ClientID
            };

            _context.ClientAccounts.Add(clientBankAccount);
            _context.SaveChanges();

            return(GetOne(clientBankAccount.ClientID, clientBankAccount.AccountNum));
        }