public async Task <IActionResult> AddAppToRoleAsync(IFormCollection forms) { #region 参数验证 Check.IfNullOrZero(forms); #endregion var response = new ResponseSimple(); var powerIds = forms["val_apps_id"].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(Int32.Parse).ToArray(); if (powerIds.Any()) { await _securityServices.AddPowerToCurrentRoleAsync(Int32.Parse(forms["val_roleId"]), powerIds); response.IsSuccess = true; response.Message = "将权限附加到角色中成功"; } else { response.Message = "一个角色至少拥有一个app"; } return(Json(response)); }