private async Task <MyPokemon> LetPokemonAppear(Type type)
        {
            var givePokemonType = await pokemonContext.Set <PokemonType>()//een join van Pokemon, PokemonType en Type
                                  .Include(pt => pt.Pokemon)
                                  .ThenInclude(p => p.PokemonTypes)
                                  .Where(p => p.Type.Name.ToLower() == type.Name.ToLower())
                                  .Include(pt => pt.Type)
                                  .ThenInclude(t => t.PokemonTypes)
                                  .ToListAsync();

            int max = givePokemonType.Count();

            if (max != 0)
            {
                int listItem        = random.Next(0, max);
                var appearedPokemon = givePokemonType[listItem]; //geeft een Pokemon met type. Moet omgezet worden naar een Pokemon
                                                                 //HttpContext.Session.SetString("AppearedPokemon", appearedPokemon.Pokemon.Name);
                string serializedPokemon = HttpContext.Session.GetString("PokemonData");
                var    pokemonData       = JsonConvert.DeserializeObject <PokemonSessionData>(serializedPokemon);
                pokemonData.Name  = appearedPokemon.Pokemon.Name;
                pokemonData.Id    = appearedPokemon.Pokemon.Id;
                pokemonData.HP    = 50; //dit wordt random bepaald
                pokemonData.Moves = new List <string> {
                    "Bite", "Shadowball"
                };                                                            //dit wordt bepaald per type
                string serializedPokemonData = JsonConvert.SerializeObject(pokemonData);
                HttpContext.Session.SetString("PokemonData", serializedPokemonData);

                return(appearedPokemon.Pokemon);
            }
            else
            {
                return(null);
            }
        }
 public IActionResult WalkAround(ExploreWalkAroundVm userData)//bevat een omgeving en tijdstip
 {
     if (ModelState.IsValid)
     {
         Type foundType = FindType(userData.SelectedEnvironmentId, userData.SelectedDayTimeId);
         PokemonSessionData pokemonData = new PokemonSessionData();
         pokemonData.Type = foundType.Name;
         string serializedPokemonData = JsonConvert.SerializeObject(pokemonData);
         HttpContext.Session.SetString("PokemonData", serializedPokemonData);
         return(new RedirectToActionResult("GeneratePokemon", "Explore", null));
     }
     else
     {
         return(View(userData));
     }
 }