public async Task <JsonResult> Delete(int id) { JsonModel json = new JsonModel { Code = 200, Msg = "删除成功!" }; try { if (id <= 0) { json.Msg = "请您选择删除的菜单!"; return(Json(json)); } if (await _moduleViewModelService.IsHaveChildAsync(id)) { json.Msg = "请您先删除子菜单!"; return(Json(json)); } await _moduleService.DeleteByIdAsync(id); //根据模块ID删除模块角色数据 await _moduleService.DeleteModulesInRoleModules(id); } catch (Exception ex) { json.Code = 500; json.Msg = "删除失败!" + ex.Message; } return(Json(json)); }