public ActionResult Delete(int id) { try { var entity = _elementService.GetById(id); if (entity == null) { return(HttpNotFound()); } _elementService.Remove(entity); Success($"<strong>{entity.DisplayName}</strong> was successfully deleted."); return(RedirectToAction("Index")); } catch { return(View()); } }