Exemplo n.º 1
0
        private async Task <SymptomDiscriminator> GetSymptomDiscriminator(string symptomDiscriminatorCode)
        {
            var url = string.Format(_configuration.GetBusinessApiSymptomDiscriminatorUrl(symptomDiscriminatorCode));
            var symptomDiscriminatorResponse = await _restClient.ExecuteAsync <SymptomDiscriminator>(new JsonRestRequest(url, Method.GET));

            if (!symptomDiscriminatorResponse.IsSuccessful)
            {
                throw new Exception(string.Format("A problem occured getting the symptom discriminator at {0}. {1}",
                                                  _configuration.GetBusinessApiSymptomDiscriminatorUrl(symptomDiscriminatorCode),
                                                  symptomDiscriminatorResponse.ErrorMessage));
            }

            return(symptomDiscriminatorResponse.Data);
        }
Exemplo n.º 2
0
        private async Task <SymptomDiscriminator> GetSymptomDiscriminator(string symptomDiscriminatorCode)
        {
            var symptomDiscriminatorResponse = await
                                               _restfulHelper.GetResponseAsync(
                string.Format(_configuration.GetBusinessApiSymptomDiscriminatorUrl(symptomDiscriminatorCode)));

            if (!symptomDiscriminatorResponse.IsSuccessStatusCode)
            {
                throw new Exception(string.Format("A problem occured getting the symptom discriminator at {0}. {1}",
                                                  _configuration.GetBusinessApiSymptomDiscriminatorUrl(symptomDiscriminatorCode),
                                                  await symptomDiscriminatorResponse.Content.ReadAsStringAsync()));
            }

            return
                (JsonConvert.DeserializeObject <SymptomDiscriminator>(await symptomDiscriminatorResponse.Content.ReadAsStringAsync()));
        }