private void BtnExluir_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(txtArea.Text) || !string.IsNullOrWhiteSpace(txtId.Text) || !string.IsNullOrWhiteSpace(txtCidade.Text) || !string.IsNullOrWhiteSpace(txtComissao.Text) || !string.IsNullOrWhiteSpace(txtDescricao.Text) || !string.IsNullOrWhiteSpace(txtRua.Text) || !string.IsNullOrWhiteSpace(txtUF.Text) || !string.IsNullOrWhiteSpace(txtValorAluguel.Text)) { Imovel.Area = Convert.ToDouble(txtArea.Text); Imovel.Cidade = txtCidade.Text; Imovel.Endereco = txtRua.Text; Imovel.UF = txtUF.Text; Imovel.ValorAluguel = Convert.ToDouble(txtValorAluguel.Text); Imovel.TipoImovel.Comissao = Convert.ToInt32(txtComissao.Text); Imovel.TipoImovel.Descricao = txtDescricao.Text; if (ImovelDAO.Remover(Imovel)) { MessageBox.Show("Imóvel 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); } }
public IActionResult Remover(Imovel imovel, int id) { _imovelDAO.Remover(imovel); return RedirectToAction("CardsImoveis", "Imovel"); }