Ejemplo n.º 1
0
        private bool Map(HttpResponseMessage response)
        {
            var result = new ServiceCallResult <bool>
            {
                CallStatusCode    = response.StatusCode,
                CallStatusMessage = response.ReasonPhrase,
                Results           = response.IsSuccessStatusCode
            };

            return(result.Results);
        }
Ejemplo n.º 2
0
        private ServiceCallResult <T> ReadAndMap <T>(HttpResponseMessage response)
        {
            var result = new ServiceCallResult <T>
            {
                CallStatusCode    = response.StatusCode,
                CallStatusMessage = response.ReasonPhrase
            };

            if (response.IsSuccessStatusCode)
            {
                result.Results = response.Content.ReadAsAsync <T>().Result;
            }

            return(result);
        }