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); }
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); }