public IActionResult Delete(int KategoriID) { try{ _ktg.Delete(KategoriID); var data = _ktg.GetAll(); ViewData["pesan"] = "<span class='alert alert-success'> Data Sudah Dihapus</span>"; return(View("Index", data)); }catch (Exception ex) { return(Content($"Error: {ex.Message}")); } }
public IActionResult DeletePost(string id) { try { _kategori.Delete(id); TempData["Pesan"] = HelperAlert.GetAlert("success", "Konfirmasi", $"Data kategori dengan id:{id} berhasil didelete"); } catch (Exception ex) { TempData["Pesan"] = HelperAlert.GetAlert("danger", "Kesalahan", $"{ex.Message}"); } return(RedirectToAction("Index")); }