Esempio n. 1
0
        public IEnumerable <AccountDTO> deleteAccountFromClient(String clientId, int accountId)
        {
            Client client = clientRepository.GetByID(clientId);

            accountRepository.Delete(accountId);


            return(AccountConverter.toDtos(accountRepository.Get().Where(x => x.Client.SocialSecurityNumber == clientId)));
        }
Esempio n. 2
0
        public IEnumerable <AccountDTO> addAccountToClient(String clientId, int accountId)
        {
            Client  client  = clientRepository.GetByID(clientId);
            Account account = accountRepository.GetByID(accountId);

            if (client == null || account == null)
            {
                throw new InvalidOperationException("Client or account does not exist");
            }

            account.Client = client;
            accountRepository.Update(account);

            return(AccountConverter.toDtos(accountRepository.Get().Where(x => x.Client.SocialSecurityNumber == clientId)));
        }
Esempio n. 3
0
 public IEnumerable <AccountDTO> getAllAccounts()
 {
     return(AccountConverter.toDtos(accountRepository.Get()));
 }