Exemple #1
0
        public async Task <StandardsView> GetStandardsAsync(bool refreshCache = false)
        {
            if (!await _cache.ExistsAsync(StandardsKey) || refreshCache)
            {
                var api = new StandardApiClient(_configuration.BaseUrl);

                var standards = api.FindAll().OrderBy(x => x.Title).ToList();

                await _cache.SetCustomValueAsync(StandardsKey, MapFrom(standards));
            }

            return(await _cache.GetCustomValueAsync <StandardsView>(StandardsKey));
        }
Exemple #2
0
        public Task <StandardsView> GetStandardsAsync(bool refreshCache = false)
        {
            if (!_cache.Exists(StandardsKey) || refreshCache)
            {
                var api = new StandardApiClient(_apprenticeshipInfoServiceApiBase);

                //BUG: FindAll should be FindAllAsync - currently a blocking call.
                var standards = api.FindAll().OrderBy(x => x.Title).ToList();

                _cache.Set(StandardsKey, MapFrom(standards));
            }

            return(Task.FromResult(_cache.Get <StandardsView>(StandardsKey)));
        }