protected void Button2_Click(object sender, EventArgs e) { //insertar Jugador jugador = new Jugador(); jugador.nombre= txtnombre.Text; jugador.apellido = txtapellido.Text; jugador.idseleccion = DropDownList2.SelectedIndex; jugador.edad = Convert.ToInt32(txted.Text); ctx.Jugador.AddObject(jugador); ctx.SaveChanges(); Label2.Text = "Cargado correctamente"; }
/// <summary> /// Crear un nuevo objeto Jugador. /// </summary> /// <param name="id">Valor inicial de la propiedad id.</param> /// <param name="idseleccion">Valor inicial de la propiedad idseleccion.</param> public static Jugador CreateJugador(global::System.Int32 id, global::System.Int32 idseleccion) { Jugador jugador = new Jugador(); jugador.id = id; jugador.idseleccion = idseleccion; return jugador; }
/// <summary> /// Método desusado para agregar un nuevo objeto al EntitySet Jugador. Considere la posibilidad de usar el método .Add de la propiedad ObjectSet<T> asociada. /// </summary> public void AddToJugador(Jugador jugador) { base.AddObject("Jugador", jugador); }