示例#1
0
文件: Extentions.cs 项目: iCSJ/WebApi
 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);
 }
示例#2
0
文件: Extentions.cs 项目: iCSJ/WebApi
        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);
        }