public async Task <ActionDefineSearchResponse> Search(ActionDefineSearchRequest request) { ActionDefineSearchResponse response = new ActionDefineSearchResponse(); try { RefSqlPaging sqlPaging = new RefSqlPaging(request.PageIndex, 30); RActionDefine[] actionDefines = await _roleService.ActionDefineGet(request.Group, string.Empty, sqlPaging); RRoleActionMapping[] roleActionMappings = await _roleService.RoleActionMappingGetByRoleIdFromDb(request.RoleId); response.TotalRow = sqlPaging.TotalRow; response.ActionDefines = actionDefines.Select(p => p.ToModel(roleActionMappings.Any(q => q.ActionId == p.Id))).GroupBy(p => p.Group).Select(p => new KeyValuePair <string, ActionDefineViewModel[]>(p.Key, p.OrderBy(q => q.Name).ToArray())).ToArray(); response.PageIndex = sqlPaging.PageIndex; response.PageSize = sqlPaging.PageSize; response.SetSucess(); } catch (Exception e) { response.SetFail(e); _logger.LogError(e, e.Message, request); } return(response); }