TaxRate GetRate(Order order) { var rates = _taxRepository.GetTaxRates().ToList(); //check the ZIP first - this allows zip-based overrides for places //like Universities, that may have 4% lower tax TaxRate result = (from r in rates where r.Zip == order.ShippingAddress.Zip select r).SingleOrDefault(); if (result == null) { result = (from rs in rates where rs.Region == order.ShippingAddress.StateOrProvince && rs.Country == order.ShippingAddress.Country select rs).SingleOrDefault(); } return(result); }