Ejemplo n.º 1
0
        public static int ReturnCount(string format, IRestResponse apiResponse)
        {
            string responseString = apiResponse.Content;
            int    intValue       = 0;

            if (format.Equals("json"))
            {
                var    jObject = JObject.Parse(responseString);
                string value   = jObject["_meta"]["totalCount"].Value <string>();
                intValue = int.Parse(value);
            }
            else if (format.Equals("xml"))
            {
                var    responseObject = Deserialization.ResponseDeserialization(apiResponse);
                string value          = responseObject.TotalCount;
                intValue = int.Parse(value);
            }
            return(intValue);
        }