public void CloseCredit(Credit credit) { if (Amount >= credit.Amount) { Amount -= credit.Amount; Credits.Remove(credit); Bank.CloseCredit(credit); CreditClosed?.Invoke(this, credit); } else { var msg = $"У Клиента{this}\nНедостаточно средств, \nдля заркытия кредита!"; NotEnoughMoney?.Invoke(msg); } }
public void CloseCredit(Credit credit) { try { WithdrawMoney(credit.Amount); Amount -= credit.Amount; Credits.Remove(credit); Bank.CloseCredit(credit); CreditClosed?.Invoke(this, credit); } catch (NotEnoughtMoneyExeption) { var msg = $"У Клиента{this}\nНедостаточно средств, \nдля заркытия кредита!"; NotEnoughMoney?.Invoke(msg); } }
/// <summary> /// Закрытие кредита /// </summary> public void Close() { Holder.CloseCredit(this); CreditClosed?.Invoke(this); }