private void BtnExluir_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(txtNome.Text) || !string.IsNullOrWhiteSpace(txtCPF.Text) || !string.IsNullOrWhiteSpace(txtTelefone.Text) || !string.IsNullOrWhiteSpace(txtEmail.Text) || !string.IsNullOrWhiteSpace(txtCidade.Text) || !string.IsNullOrWhiteSpace(txtCOEFI.Text) || !string.IsNullOrWhiteSpace(txtUF.Text)) { Corretor.Nome = txtNome.Text; Corretor.Cpf = txtCPF.Text; Corretor.Telefone = txtTelefone.Text; Corretor.Email = txtEmail.Text; Corretor.Cidade = txtCidade.Text; Corretor.Cofeci = txtCOEFI.Text; Corretor.UF = txtUF.Text; if (CorretorDAO.Remover(Corretor)) { MessageBox.Show("Corretor excluído com sucesso!", "Imob", MessageBoxButton.OK, MessageBoxImage.Information); LimparFormulario(); } else { MessageBox.Show("Erro interno: tente novamente ou contate um ADM!", "Imob", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("Todos os campos são obrigatórios", "Imob", MessageBoxButton.OK, MessageBoxImage.Error); } }
// Remover public IActionResult Remover(int id) { _corretorDAO.Remover(id); return(RedirectToAction("ListaCorretores", "Corretor")); }