public List <PokeTeam> Delete() { List <PokeTeam> poketeams = GetAll(); PokeTeam poketeam = new PokeTeam(); try { poketeams.Remove(poketeams.FirstOrDefault(p => p.PokemonTeam_ID == Console.Read())); Save(poketeams); } catch (Exception ex) { ex.Data.Add("DeleteError", $"An error occurred while trying to delete a player. (Player ID: {poketeam.PokemonTeam_ID}"); throw; } return(poketeams); }
public static PokeTeam Select() { List <PokeTeam> poketeams = GetAll(); //get the next team id int PokemonTeam_ID = GetNextId(poketeams); PokeTeam poketeam = new PokeTeam(); var name = Console.ReadLine(); Pokemon listOfPokemon = FindPokemonByName(name); //add the pokemon to the list poketeams.Add(poketeam); //save the list Save(poketeams); //return the pokemon with the new ID return(poketeam); //} }