private void SearchButton_Click(object render, RoutedEventArgs e) { Contexto context = new Contexto(); var found = PrestamoBLL.Search(Convert.ToInt32(PrestamoIdTextBox.Text)); if (found != null) { this.prestamo = found; } else { this.prestamo = new Prestamo(); MessageBox.Show("No encontrado", "Error", MessageBoxButton.OK); } this.DataContext = this.prestamo; }