protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int jugadorId = ((Jugador)Session["Logueado"]).JugadorId; var mensajes = LogicaMensaje.FindByJugadores(jugadorId, 5); RptMensajes.DataSource = mensajes; RptMensajes.DataBind(); } }
protected void BtnEnviar_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(TxtMensaje.Text)) { int jugadorUno = ((Jugador)Session["Logueado"]).JugadorId; int jugadorDos = int.Parse(HdnDestinatarioId.Value); Mensaje M = new Mensaje { Fecha = DateTime.Now, Leido = false, Texto = TxtMensaje.Text }; LogicaMensaje.Add(M, jugadorUno, jugadorDos); } }