Beispiel #1
0
        public async Task <IEnumerable <ActiveLocale> > ExecuteAsync(GetAllQuery <ActiveLocale> query, IExecutionContext executionContext)
        {
            var results = await _cache.GetOrAddAsync(new Func <Task <ActiveLocale[]> >(async() =>
            {
                return(await GetAllLocales().ToArrayAsync());
            }));

            return(results);
        }
        public async Task <ICollection <ActiveLocale> > ExecuteAsync(GetAllActiveLocalesQuery query, IExecutionContext executionContext)
        {
            var results = await _cache.GetOrAddAsync(new Func <Task <ICollection <ActiveLocale> > >(async() =>
            {
                var dbResults = await GetAllLocales().ToListAsync();
                var mappedResults = dbResults
                                    .Select(_activeLocaleMapper.Map)
                                    .ToList();

                return(mappedResults);
            }));

            return(results);
        }