public double CalculateTax(double itemPrice) { foreach (var country in countries) { if (country.IsDefault) { return itemPrice + itemPrice * country.VATTax; } } var up = new NotSupportedCountryException("No default country in calculator database!"); throw up; }
public double CalculateTax(double itemPrice, int countryId) { foreach (var country in countries) { if (country.CountryId == countryId) { return itemPrice + itemPrice * country.VATTax; } } var up = new NotSupportedCountryException("Id not found in the calculator database!"); throw up; }