public async Task <IResponseEntity> GetAllAsync(GroupFilterRequest req) { var withDisable = req != null ? req.WithDisable : false; var key = req?.Key; var data = await _sysGroupRepository.Select .WhereIf(key.IsNotNull(), a => (a.Title.Contains(key) || a.Code.Contains(key))) .WhereIf(!withDisable, a => a.IsDisabled == false) .OrderBy(true, a => a.OrderIndex) .ToListAsync(); var result = _mapper.Map <List <GroupForListResponse> >(data); return(ResponseEntity.Ok(result)); //var cacheKey = string.Format(CacheKeyTemplate.PermissionGroupList, _authUser.PermissionId, withDisable ? "withDisable" : "onlyEnable"); //List<SysGroupEntity> data = new List<SysGroupEntity>(); //if (await _cache.ExistsAsync(cacheKey)) //{ // data = await _cache.GetAsync<List<SysGroupEntity>>(cacheKey); //} //else //{ // var key = req?.Key; // data = await _sysGroupRepository.Select // .WhereIf(key.IsNotNull(), a => (a.Title.Contains(key) || a.Code.Contains(key))) // .WhereIf(!withDisable, a => a.IsDisabled == false) // .OrderBy(true, a => a.OrderIndex) // .ToListAsync(); // await _cache.SetAsync(cacheKey, data); //} //var result = _mapper.Map<List<GroupForListResponse>>(data); //return ResponseEntity.Ok(result); }
public async Task <IResponseEntity> GetAll(GroupFilterRequest req) { return(await _sysGroupService.GetAllAsync(req)); }