private void WithdrawFromAccount() { decimal withdrawed = bankAccount.CoinsParser(); if (withdrawed <= bankAccount.AccountAmount) { bankAccount.AccountAmount -= withdrawed; Notify?.Invoke($"From Account Withdrawed {withdrawed} coins"); } else { NotifyError?.Invoke($"Insufficient Funds!"); } ShowMenu(); }
public bool Create(Person item) { if (item == null) { throw new InvalidOperationException("The person to create can't be null"); } var created = false; var validationResult = _validator.Validate(item); if (validationResult.HasError) { NotifyError?.Invoke(this, validationResult); } else { created = _repository.Create(item); } return(created); }
public bool Update(Company item) { if (item == null) { throw new InvalidOperationException("The company can't be null"); } var updated = false; var validationResult = _validator.Validate(item); if (validationResult.HasError) { NotifyError?.Invoke(this, validationResult); } else { updated = _repository.Update(item); } return(updated); }
void SafeNotifyError(string message, Exception ex) { NotifyError?.Invoke(message, ex); }