protected ApiResponseResult <T> ApiResponseResult <T>(string body, HttpStatusCode code) where T : BaseResponse { try { var response = JsonConvert.DeserializeObject <T>(body); if (response == null) { throw new HttpRequestException(string.Empty); } return(response.Code == ResponseCodes.OkResponse ? Api.ApiResponseResult <T> .Ok(response) : Api.ApiResponseResult <T> .Fail(response, code, response.Error)); } catch (JsonException) { throw new HttpRequestException(code.Description()); } }
protected ApiResponseResult <T> ApiResponseResult <T>(string body, HttpStatusCode code) where T : BaseResponse { try { T response = JsonConvert.DeserializeObject <T>(body); if (response == null) { throw new HttpRequestException(string.Empty); } ApiResponseResult <T> result = CreateApiResponseResult(response, code); HandleResult(result); return(result); } catch (JsonException) { throw new HttpRequestException(code.Description()); } }