Exemplo n.º 1
0
        public async Task <IActionResult> Index(int?id)
        {
            int desiredId = id ?? 1; //Set desiredId to "id", if null, set it to 1

            ViewData["Id"] = desiredId;

            Pokemon result = await PokeAPIHelper.GetById(desiredId);

            PokedexEntryViewModel entry = PokeAPIHelper.GetPokedexEntryFromPokemon(result);

            return(View(entry)); //Model binds the entry object to the Index view
        }
        public async Task <IActionResult> IndexAsync(int?id)
        {
            int desiredId = id ?? 1;

            ViewData["Id"] = desiredId;

            Pokemon result = await PokeAPIHelper.GetById(desiredId);

            PokedexEntryViewModel entry = PokeAPIHelper.GetPokedexEntryFromPokemon(result);

            return(View(entry));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Index(int?id)
        {
            // Set the id as the int passed in otherwise set it to 1
            int desiredId = id ?? 1;

            ViewData["Id"] = desiredId;

            Pokemon result = await PokeAPIHelper.GetById(desiredId);

            PokedexEntryViewModel entry = PokeAPIHelper.GetPokedexEntryFromPokemon(result);

            return(View(entry));
        }