static async Task Main(string[] args) { var service = new PokemonService("https://graphql-pokemon.now.sh"); IEnumerable <Pokemon> pokemons; if (args != null && args.Length > 0) { if (args.Length == 1) { pokemons = new List <Pokemon> { await service.GetPokemon(args[0]) }; } else { pokemons = await service.GetPokemonBatch(args); } } else { pokemons = await service.GetAllPokemons(); } foreach (var pokemon in pokemons) { Console.WriteLine(pokemon); } }
static async Task Main(string[] args) { var service = new PokemonService("https://graphql-pokemon.now.sh"); IEnumerable <Pokemon> pokemons; if (args != null && args.Length > 0) { pokemons = await Task.WhenAll(args.Select(name => service.GetPokemon(name))); } else { pokemons = await service.GetAllPokemons(); } foreach (var pokemon in pokemons) { Console.WriteLine(pokemon); } }
public MainViewModel() { _pokemonService = new PokemonService(); }
public PokemonViewModel(AdditionalInfo pokemon) { _pokemon = pokemon; _pokemonService = new PokemonService(); }