/// <summary>
 ///     Recibe la lista de profesores del cliente http
 /// </summary>
 /// <returns></returns>
 private async Task GetAllTeachers()
 {
     try
     {
         this.teachers = await TeacherHttpService.GetAll();
     }
     catch (ServerErrorException ex)
     {
         new CustomErrorMessageWindow(ex.Message).ShowDialog();
     }
 }
        /// <summary>
        ///     Evento al pulsar Guardar cambios:
        ///     Se crea un profesor con los nuevos datos
        ///     introducidos y se envia al cliente http, el cuál retorna
        ///     el profesor actualizado
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ButtonCreateTeacher_Click(object sender, EventArgs e)
        {
            this.ResetAsterisks();

            string dni       = this.tbDni.Text.TrimStart(' ').TrimEnd(' ');
            string firstName = this.tbFirstName.Text.TrimStart(' ').TrimEnd(' ');
            string lastName1 = this.tbLastName1.Text.TrimStart(' ').TrimEnd(' ');
            string lastName2 = this.tbLastName2.Text.TrimStart(' ').TrimEnd(' ');


            //Si los 3 campos obligatorios tienen texto, se crea el objeto
            if (dni.Length > 0 && firstName.Length > 0 && lastName1.Length > 0)
            {
                Teacher teacher = new Teacher()
                {
                    Id        = this.teacherId,
                    Dni       = dni,
                    FirstName = firstName,
                    LastName1 = lastName1,
                    LastName2 = lastName2
                };

                try
                {
                    teacher = await TeacherHttpService.Update(teacher);

                    //Ventanita con mensaje de éxito
                    string message = "Has actualizado los datos del profesor";
                    new CustomSuccesMessageWindow(message).ShowDialog();
                    this.Close();

                    this.OnTeacherUpdatedDelegate(teacher);//Respuesta
                }
                catch (ServerErrorException ex)
                {
                    new CustomErrorMessageWindow(ex.Message).ShowDialog();
                }
            }
            //Se cambia el color del asteriscos de los campos obligatorios vacios
            if (dni.Length == 0)
            {
                this.LabelDniAsterisk.ForeColor = Settings.Default.OPTIMA_COLOR;
            }
            if (firstName.Length == 0)
            {
                this.LabelFirstNameAsterisk.ForeColor = Settings.Default.OPTIMA_COLOR;
            }
            if (lastName1.Length == 0)
            {
                this.LabelLastNameAsterisk.ForeColor = Settings.Default.OPTIMA_COLOR;
            }
        }