示例#1
0
        public static BestSellersListNames GetNytBestSellersListNames()
        {
            BestSellersListNames bs = null;
            string res = String.Empty;

            using (WebParser wp = new WebParser(cStrNYTBooksBaseUrl))
            {
                res = wp.Request(cStrNYTBooksResource, Method.GET, cStrNYTApiKeyStr, cStrNYTApiKeyVal);
                bs  = wp.DeserializeJson <BestSellersListNames>(res);
            }
            return(bs);
        }
示例#2
0
        public static BestSellersListNames GetNYTBestSellersListNames()
        {
            BestSellersListNames bs = null;

            try
            {
                using (WebParser wp = new WebParser(cStrNYTBooksBaseUrl))
                {
                    string res = wp.Request(cStrNYTBooksResource, Method.GET, cStrNYTApiKeyStr, cStrNYTApiKeyVal);

                    bs = wp.DeserializeJson <BestSellersListNames>(res);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            return(bs);
        }
示例#3
0
        public static void DisplayNYTBestSellersListNames()
        {
            try
            {
                BestSellersListNames b = GetNYTBestSellersListNames();

                if (b != null && b.results.Length > 0)
                {
                    foreach (BestSellerListNamesItems i in b.results)
                    {
                        Console.WriteLine("Name: " + i.display_name);
                        Console.WriteLine("Oldest Published Date: " + i.oldest_published_date.ToString());
                        Console.WriteLine("Newest Published Date: " + i.newest_published_date.ToString());
                        Console.WriteLine(Environment.NewLine);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }