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))); }
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))); }
public IEnumerable <AccountDTO> getAllAccounts() { return(AccountConverter.toDtos(accountRepository.Get())); }