public async Task <StandardsView> GetStandardsAsync(bool refreshCache = false)
        {
            if (!_cache.Exists(StandardsKey) || refreshCache)
            {
                var response = await _apiClient.Get <GetStandardsResponse>(new GetStandardsRequest());

                _cache.Set(StandardsKey, MapFrom(response.Standards));
            }

            return(_cache.Get <StandardsView>(StandardsKey));
        }
Пример #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)));
        }