public IActionResult CreatePokemon(CreateTeamPokemonViewModel pokemonTeamDetail, int pokemonTeamId)
        {
            if (!this.ModelState.IsValid)
            {
                CreateTeamPokemonViewModel model = new CreateTeamPokemonViewModel()
                {
                    AllPokemon = this.FillPokemonList(pokemonTeams[pokemonTeamId - 1]),
                    AllNatures = this.dataService.GetObjects <Nature>("Name"),
                    NatureId   = this.dataService.GetObjectByPropertyValue <Nature>("Name", "Serious").Id,
                    GameId     = pokemonTeamDetail.GameId,
                    Level      = 100,
                    Happiness  = 255,
                };

                return(this.View(model));
            }

            PokemonTeam pokemonTeam = pokemonTeams[pokemonTeamId - 1];

            Pokemon pokemon = this.dataService.GetPokemonById(pokemonTeamDetail.PokemonId);

            if (pokemon.GenderRatioId == 10)
            {
                pokemonTeamDetail.Gender = null;
            }

            int pokemonTeamDetailId = this.dataService.AddPokemonTeamDetail(pokemonTeamDetail);

            pokemonTeam.InsertPokemon(this.dataService.GetPokemonTeamDetail(pokemonTeamDetailId));

            this.dataService.UpdatePokemonTeam(pokemonTeam);

            return(this.RedirectToAction("PokemonTeams", "User"));
        }
        public IActionResult CreatePokemon(int pokemonTeamId)
        {
            this.UpdatePokemonTeamList();
            if (pokemonTeams.Count < pokemonTeamId || pokemonTeams[pokemonTeamId - 1].SixthPokemonId != null)
            {
                return(this.RedirectToAction("PokemonTeams", "User"));
            }
            else
            {
                PokemonTeam                pokemonTeam = pokemonTeams[pokemonTeamId - 1];
                List <Pokemon>             pokemonList = this.FillPokemonList(pokemonTeam);
                CreateTeamPokemonViewModel model       = new CreateTeamPokemonViewModel()
                {
                    AllPokemon = pokemonList,
                    AllNatures = this.dataService.GetObjects <Nature>("Name"),
                    NatureId   = this.dataService.GetObjectByPropertyValue <Nature>("Name", "Serious").Id,
                    GameId     = pokemonTeam.GameId,
                    Level      = 100,
                    Happiness  = 255,
                };

                return(this.View(model));
            }
        }