Пример #1
0
        public async Task <Result <List <GetAllClaimsResponse> > > Handle(GetAllClaimsQuery request, CancellationToken cancellationToken)
        {
            var claimList = await _claim.GetListAsync();

            var mappedClaims = _mapper.Map <List <GetAllClaimsResponse> >(claimList);

            return(Result <List <GetAllClaimsResponse> > .Success(mappedClaims));
        }
        public async Task <List <Claim> > GetCachedListAsync()
        {
            string cacheKey  = ClaimCacheKeys.ListKey;
            var    claimList = await _distributedCache.GetAsync <List <Claim> >(cacheKey);

            if (claimList == null)
            {
                claimList = await _claimRepository.GetListAsync();

                await _distributedCache.SetAsync(cacheKey, claimList);
            }
            return(claimList);
        }