/// <summary> /// 批量添加功能菜单 /// </summary> /// <param name="menuFunctionInputDto">输入DTO</param> /// <returns></returns> public async Task <OperationResponse> BatchAddMenuFunctionAsync(BatchAddMenuFunctionInputDto menuFunctionInputDto) { return(await _unitOfWork.UseTranAsync(async() => { List <MenuFunction> menuFunctions = new List <MenuFunction>(); foreach (var menuId in menuFunctionInputDto.MenuIds) { foreach (var functionId in menuFunctionInputDto.FunctionIds) { menuFunctions.Add(new MenuFunction() { MenuId = menuId, FunctionId = functionId }); } } var count = await _menuFunctionRepository.InsertAsync(menuFunctions.ToArray()); if (count <= 0) { return new OperationResponse(OperationResponseType.NoChanged.ToDescription(), OperationResponseType.NoChanged); } return OperationResponse.Ok($"{count}个菜单功能添加成功"); })); }
public async Task <AjaxResult> BatchAddMenuFunctionAsync([FromBody] BatchAddMenuFunctionInputDto menuFunctionInputDto) { return((await _menuFunctionServices.BatchAddMenuFunctionAsync(menuFunctionInputDto)).ToAjaxResult()); }