Пример #1
0
        public GetTaxRateResponse GetTaxInfo(string stateAbbreviation)
        {
            ListTaxResponse    taxResponse = _taxRepository.LoadTaxInfo(ConfigurationManager.AppSettings["TaxFilePath"].ToString());
            GetTaxRateResponse response    = new GetTaxRateResponse();

            if (taxResponse.Success)
            {
                var taxInfo = taxResponse.TaxList;

                var stateCheck = (from tax in taxInfo
                                  where tax.StateAbbreviation == stateAbbreviation
                                  select tax).ToArray();

                if (stateCheck.Any())
                {
                    response.TaxRate = stateCheck[0].TaxRate;
                    response.Success = true;
                }
                else
                {
                    response.Success = false;
                    response.Message = "We cannot do work in that state!";
                }
            }
            else
            {
                response.Success = false;
                response.Message = taxResponse.Message;
            }

            return(response);
        }