Last active
January 31, 2017 08:07
-
-
Save tarikguney/e72b125c02b77d7647de3b2fa4bccad7 to your computer and use it in GitHub Desktop.
Account Creator Class for Medium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AccountCreator { | |
private IAccountChecker _accountChecker; | |
private AccountRepository _accountRepository; | |
public AccountCreator(IAccountChecker accountChecker){ | |
_accountChecker = accountChecker; | |
_accountRepository = new AccountRepository(); | |
} | |
public bool TryCreateAccount(AccountInfo accountInfo){ | |
if(!_accountChecker.Exists(accountInfo.AccountNumber){ | |
_accountCreator.Create(accountInfo); | |
return true; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment