Example #1
0
        public static async Task <RestStatus> GetErrorPercentage(ErrorPercentageDto errPercdto)
        {
            try
            {
                RestStatus status = new RestStatus();
                using (var httpClient = new HttpClient())
                {
                    HttpResponseMessage response = await httpClient.PostAsync(ERROR_REPORT_URL, new StringContent(JsonConvert.SerializeObject(errPercdto), Encoding.UTF8, "application/json"));

                    using (HttpContent content = response.Content)
                    {
                        string responseText = await content.ReadAsStringAsync();

                        status.HttpCode = response.StatusCode;
                        if (status.HttpCode == System.Net.HttpStatusCode.OK)
                        {
                            status.HttpResponse = responseText;
                        }
                        else
                        {
                            dynamic state = JsonConvert.DeserializeObject <dynamic>(status.HttpResponse);
                            status.StatusMessage = state.error_description;
                        }
                    }
                }
                return(status);
            }
            catch (Exception ex)
            {
                Log.This(ex);
                throw;
            }
        }
Example #2
0
 public object GetErrorPercentage(ErrorPercentageDto errPercdto)
 {
     return(tanservice.GetErrorPercReport(errPercdto));
 }