private async void BtnDelete_Clicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtId.Text)) { await DisplayAlert("Error", "Id wrong", "Ok"); } else { try { await contatoService .DeleteContato(Convert.ToInt32(txtId.Text)); txtId.Text = string.Empty; txtName.Text = string.Empty; txtEmail.Text = string.Empty; await DisplayAlert("Sucesso", "Deleted", "Ok"); await ShowContact(); } catch (Exception ex) { await DisplayAlert("Error", "User did not Delete" + ex.Message, "Ok"); } } }
private async void BtnDeletar_Clicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtId.Text)) { await DisplayAlert("Erro", "ID do contato inválido", "Ok"); } else { try { await contatoService.DeleteContato(Convert.ToInt32(txtId.Text)); txtId.Text = string.Empty; await DisplayAlert("Sucesso", "Contato deletado com sucesso", "Ok"); await ExibeContatos(); } catch (Exception ex) { await DisplayAlert("Erro", "Contato não deletado : " + ex.Message, "Ok"); } } }