Ejemplo n.º 1
0
        public static IShelbyResponse ToShelbyResponse(this IRestResponse restResponse)
        {
            var response = new ShelbyResponse();

            response.StatusCode   = restResponse.StatusCode;
            response.JsonResponse = restResponse.Content;

            if (restResponse.StatusCode != System.Net.HttpStatusCode.OK)
            {
                response.ErrorMessage = restResponse.ErrorMessage;
            }

            return(response);
        }
Ejemplo n.º 2
0
        public static IShelbyResponse <S> ToShelbyResponse <S>(this IRestResponse <S> restResponse) where S : new()
        {
            var response = new ShelbyResponse <S>();

            response.StatusCode   = restResponse.StatusCode;
            response.JsonResponse = restResponse.Content;

            if ((int)restResponse.StatusCode >= 300)
            {
                response.ErrorMessage = restResponse.ErrorMessage;
            }
            else
            {
                response.Data = restResponse.Data;
            }
            return(response);
        }