Exemplo n.º 1
0
        private async Task GetCompetitorProfileAsync(URN id, CultureInfo culture, ISportEventCI requester)
        {
            var filePath = GetFile($"{culture.TwoLetterISOLanguageName}.competitor.{id?.Id ?? 1}.xml", culture);

            if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath))
            {
                filePath = GetFile(CompetitorProfileXml, culture);
            }
            var restDeserializer = new Deserializer <competitorProfileEndpoint>();
            var mapper           = new CompetitorProfileMapperFactory();
            var stream           = FileHelper.OpenFile(filePath);
            var result           = mapper.CreateMapper(restDeserializer.Deserialize(stream)).Map();

            if (result != null)
            {
                await _cacheManager.SaveDtoAsync(id, result, culture, DtoType.CompetitorProfile, requester).ConfigureAwait(false);
            }
        }