public List <int> GiveMoney(CurrencyType currency, int count, List <int> cash) { if (currency != _currency && _notDefault) { return(_nextHandler.GiveMoney(currency, count, cash)); } int banknoteAmount = count / _value; cash.AddRange(Enumerable.Repeat(_value, banknoteAmount)); count -= _value * banknoteAmount; if (_notDefault) { return(_nextHandler.GiveMoney(currency, count, cash)); } if (count != 0) { throw new Exception("Невозможно выдать данную сумму"); } return(cash); }
public List <int> GiveMoney(CurrencyType currency, int count) { return(_handler.GiveMoney(currency, count, new List <int>())); }