private void ajouterAttaque_Click(object sender, EventArgs e) { using (var ctx = new PokedexContext()) { AttackBox.Items.Add(ctx.Attaques); } }
private void creer_Click(object sender, EventArgs e) { labelInfo.Text = "En cours..."; using (var ctx = new PokedexContext()) { var Poke = new Pokemon(); Poke.Numero = Int32.Parse(NumeroBox.Text); Poke.Nom = NomBox.Text; Poke.PV = Int32.Parse(PVBox.Text); Poke.PD = Int32.Parse(PDBox.Text); ctx.Pokemons.Add(Poke); ctx.SaveChanges(); labelInfo.Text = "OK !"; } }