public void RemoveAccount(BankAccount account) { if (ReferenceEquals(account, null)) { throw new ArgumentNullException(nameof(account)); } if (accountsList.Contains(account)) { accountsList.Remove(account); storage.GetInstance().Save(accountsList); } else { throw new Exception("This account is alrady exists"); } }
public AccountService(IStorageFactory storage, IBonusCounter bonusCounter) { this.storage = storage; this.bonusCounter = bonusCounter; accountsList = storage.GetInstance().Load(); }