/******************************* * GetAllItems() *******************************/ public static void GetAllItems(HttpClient client) { var allItemsResp = client.GetAsync("item").Result; ItemCollection allItems = allItemsResp.Content.ReadAsAsync <ItemCollection>().Result; bool keepShopping = true; while (keepShopping) { Console.Clear(); foreach (var item in allItems.results) { Console.WriteLine(item.name.ToUpper()); } var pageMovement = Extras.WriteRead( "\n (N)ext page |" + "(P)revious page |" + "(G)et Details |" + "(E)xit: ").ToUpper(); switch (pageMovement) { case "N": allItems = allItems.GetNext(client); break; case "P": allItems = allItems.GetPrevious(client); break; case "G": GetSingleItem(client); keepShopping = false; break; default: Extras.Menu(); keepShopping = false; break; } } }
/******************************* * CatchEmAll() *******************************/ public static void CatchEmAll(HttpClient client) { HttpResponseMessage allPokemonResp = client.GetAsync("pokemon").Result; PokemonCollection catchEmAll = allPokemonResp.Content.ReadAsAsync <PokemonCollection>().Result; bool keepCatching = true; while (keepCatching) { Console.Clear(); foreach (var pokemon in catchEmAll.Results) { Console.WriteLine(pokemon.name.ToUpper()); } var pageMovement = Extras.WriteRead( "\n (N)ext page |" + "(P)revious page |" + "(G)et Details |" + "(E)xit: ").ToUpper(); switch (pageMovement) { case "N": catchEmAll = catchEmAll.GetNext(client); break; case "P": catchEmAll = catchEmAll.GetPrevious(client); break; case "G": GetSinglePokemon(client); keepCatching = false; break; default: Extras.Menu(); keepCatching = false; break; } } }