public IActionResult Delete(int id) { if (!HttpContext.Session.GetIsAdmin()) { return(NotFound()); } manager.Delete(id); return(RedirectToAction(nameof(Index))); }
public IActionResult TopicDeleteAjax(int id) { if (id <= 0) { return(Json(new { success = false, responseText = "Topic is invalid" })); } Topic topic = _TopicManager.Get(id); if (topic == null) { return(Json(new { success = true, category = "", responseText = "Deleted" })); } _TopicManager.Delete(topic); return(Json(new { success = true, category = "", responseText = "Deleted" })); }