private void btnExcluir_Click(object sender, RoutedEventArgs e) { try { ServicoController servicoController = new ServicoController(); var idExclusão = Convert.ToInt32(txtId.Text); servicoController.Excluir(idExclusão); MessageBox.Show("Excluido com sucesso"); servicoController.ListarTodos(); //listServico.ItemsSource = servicoController.ListarTodos(); } catch { MessageBox.Show("Não é possivel efetuar a exclusão"); } }
private void listaServicoAluno_Initialized(object sender, EventArgs e) { ServicoController servicoController = new ServicoController(); listaServicoAluno.ItemsSource = servicoController.ListarTodos(); }
private void cbServico_Loaded(object sender, RoutedEventArgs e) { ServicoController servicoController = new ServicoController(); cbServico.ItemsSource = servicoController.ListarTodos(); }
//preneche a lista depois de clicar em gravar public void ListaServicos(ServicoController servicoController) { listServico.ItemsSource = servicoController.ListarTodos(); }