Exemplo n.º 1
0
 public static bool TryParseResult(this ApiResultModel result, out object content)
 {
     if (result.Status != HttpStatusCode.OK)
     {
         content = result.Err;
         return(false);
     }
     content = result.Content;
     return(true);
 }
Exemplo n.º 2
0
        public static ApiResultModel ParseResult(this HttpResponseMessage response)
        {
            if (response.Content == null)
            {
                return(null);
            }
            ApiResultModel result = response.Content.ReadAsAsync <ApiResultModel>().Result;

            if (result.Status == 0)
            {
                result.Status = response.StatusCode;
            }
            return(result);
        }