public ActionResult Delete_Get(int id) { AlunoBLL alunoBll = new AlunoBLL(); alunoBll.DeletarAluno(id); return(RedirectToAction("Index")); }
private void btnExcluir_Click(object sender, EventArgs e) { if (MessageBox.Show("Deseja Deletar esses dados?", "Deletar Aluno", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (string.IsNullOrEmpty(txtCPF.Text)) { MessageBox.Show("Preencha o campo CPF", "ERRO!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var aluno = new Aluno { CPF = txtCPF.Text }; MessageBox.Show(alunoBLL.DeletarAluno(aluno)); listarAlunos(); grpAlunos.Show(); btnCadastrar.Show(); btnEditar.Hide(); btnExcluir.Hide(); btnVoltar.Hide(); } } }
public ActionResult Delete(Aluno aluno) { if (ModelState.IsValid) { AlunoBLL alunobll = new AlunoBLL(); alunobll.DeletarAluno(aluno.Id); return(RedirectToAction("Index")); } return(View(aluno)); }
public ActionResult Delete(int id) { _alunoBLL.DeletarAluno(id); return(RedirectToAction("Index")); }