Beispiel #1
0
        public async Task <IEnumerable <InvestimentoModel> > GetInvestimentos()
        {
            var modelsCached = _cacheService.GetFundos();

            if (modelsCached != null)
            {
                return(_mapper.Map <IEnumerable <InvestimentoModel> >(modelsCached.Fundos));
            }

            var result = await GetFundos();

            if (result.Succeeded)
            {
                _cacheService.AddFundos(result.Data);
                return(_mapper.Map <IEnumerable <InvestimentoModel> >(result.Data.Fundos));
            }

            return(new List <InvestimentoModel>());
        }