public ActionResult Delete(int id) { Genre genre = dao.Find(id); dao.Delete(genre); return(RedirectToAction("Index")); }
private void Delete_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(Id.Text)) { int id; if (int.TryParse(Id.Text, out id)) { genreDAO.Delete(id); } } }
public ActionResult Delete(int[] Id) { if (Session["username"] == null) { return(RedirectToAction("../Login/Index")); } if (Id == null) { ModelState.AddModelError("", "Nenhum item foi selecionado para deletar"); } if (ModelState.IsValid) { GenreDAO.Delete(Id); } return(View("Index", GenreDAO.FindAll())); }