private void matricularAlumno(object sender, RoutedEventArgs e) { if (cbAlumnoMatricula.SelectedIndex != -1) { // RECOGEMOS EL ID ALUMNO MEDIANTE LA LISTA DE ALUMNOS y EL ÍNDICE SELECCIONADO string idAlumno = listaAlumnos.ElementAt(cbAlumnoMatricula.SelectedIndex).id; // RECOGEMOS EL ID ASIGNATURA DEL OBJETO ASIGNATURA string idAsignatura = asignatura.id; // HACEMOS EL INSERT A LA BD WebService webService = new WebService(); EstadoMensajeResponse response = webService.matricular(idAlumno, idAsignatura); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarAlumnosClases(); cbAlumnoMatricula.SelectedIndex = -1; } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } else { Utils.msgBox("No ha seleccionado ningún alumno a matricular", "ok", "warning"); } }