Esempio n. 1
0
        public static CategoryModel InformationCategory(string name)
        {
            string endpoint = string.Format("categories/{0}/events/", name);
            var    client   = new RestClient(URL);
            var    request  = new RestRequest(endpoint, Method.GET);

            CategoryModel result = null;

            try
            {
                IRestResponse response = client.Execute(request);
                if (response.StatusCode == HttpStatusCode.Created)
                {
                    result = CategoryModel.FromJson(response.Content);

                    // success = true;
                }
                else
                {
                    // NOK
                    Console.Write(response.ToString());
                }
            }
            catch (Exception error)
            {
                Console.Write(error.ToString());
            }

            return(result);
        }