コード例 #1
0
ファイル: ChampionsController.cs プロジェクト: aybbr/gcomm
        private void PrepareDetailsModel(ChampionsModel.ChampionModel championModel,
                                         RiotDtos.Champion.ChampionListDto.ChampionDto championDto,
                                         RiotDtos.LolStaticData.Champion.ChampionDto staticChampionDto)
        {
            var ddragonKeyVersionsKey = string.Format(CacheKeys.DataDragonVersionByRegionKey, championModel.Region);
            var ddragonVersions       = _memoryCache.Get(ddragonKeyVersionsKey, DateTime.UtcNow.AddDays(1),
                                                         () => _riotClient.LolStaticData.GetVersionData(championModel.Region));

            var ddVersions = ddragonVersions as IList <string> ?? ddragonVersions.ToList();

            PrepareDetailsModel(championModel, championDto, staticChampionDto, ddVersions);
        }
コード例 #2
0
ファイル: ChampionsController.cs プロジェクト: aybbr/gcomm
 private void PrepareDetailsModel(ChampionsModel.ChampionModel championModel, RiotDtos.Champion.ChampionListDto.ChampionDto championDto,
                                  RiotDtos.LolStaticData.Champion.ChampionDto staticChampionDto, IEnumerable <string> ddVersions)
 {
     championModel.ChampionDto       = championDto;
     championModel.StaticChampionDto = staticChampionDto;
     championModel.ChampionImage     =
         $"http://ddragon.leagueoflegends.com/cdn/{ddVersions.FirstOrDefault()}/img/champion/{championModel.StaticChampionDto.Image.Full}";
     championModel.ChampionImage =
         $"http://ddragon.leagueoflegends.com/cdn/{ddVersions.FirstOrDefault()}/img/champion/{championModel.StaticChampionDto.Image.Full}";
     championModel.SplashImage =
         $"http://ddragon.leagueoflegends.com/cdn/img/champion/splash/{championModel.StaticChampionDto.Key}_{championModel.CurrentSkinId}.jpg";
     championModel.LoadingImage =
         $"http://ddragon.leagueoflegends.com/cdn/img/champion/loading/{championModel.StaticChampionDto.Key}_{championModel.CurrentSkinId}.jpg";
 }