public Horario DeleteHorario(string idLaboratorio)
        {
            try
            {
                Horario Horario = new Horario();

                string sql = @"DELETE FROM Laboratorios_Horas
                         WHERE idLaboratorio = @idLaboratorio";

                using (SqlConnection connection = new SqlConnection(GetConnectionString()))
                {
                    using (SqlCommand command = new SqlCommand(sql, connection))
                    {
                        command.Parameters.AddWithValue("@idLaboratorio", idLaboratorio);
                        connection.Open();
                        command.ExecuteNonQuery();
                        connection.Close();
                    }
                }
                return(Horario);
            }
            catch (Exception ex)
            {
                return(new Horario
                {
                    mensajeError = ex.Message
                });
            }
        }
        public Horario PostHorario(Horario horarioInsert)
        {
            try
            {
                Horario horario = new Horario();
                horario = DeleteHorario(horarioInsert.idLaboratorio);

                if (String.IsNullOrEmpty(horario.mensajeError))
                {
                    string sql = @"INSERT INTO Laboratorios_Horas
                               VALUES (@idLaboratorio, @idDia, @idHora,@idMateria)";

                    using (SqlConnection connection = new SqlConnection(GetConnectionString()))
                    {
                        connection.Open();

                        int cont = 1;

                        foreach (var item in horarioInsert.lstHorarios)
                        {
                            int contHora = 1;
                            for (int i = 0; i < item.Count; i++)
                            {
                                using (SqlCommand command = new SqlCommand(sql, connection))
                                {
                                    command.Parameters.AddWithValue("@idLaboratorio", horarioInsert.idLaboratorio);
                                    var idDia = obtenerDia(cont);
                                    command.Parameters.AddWithValue("@idDia", idDia);
                                    var idHora = Convert.ToString(contHora);
                                    command.Parameters.AddWithValue("@idHora", idHora);
                                    var idMateria = item[i];
                                    command.Parameters.AddWithValue("@idMateria", item[i]);
                                    command.ExecuteNonQuery();
                                }
                                contHora++;
                            }

                            cont++;
                        }
                        connection.Close();
                    }
                }

                return(horario);
            }
            catch (Exception ex)
            {
                return(new Horario
                {
                    mensajeError = ex.Message
                });
            }
        }