public async Task <IEnumerable <Tuple <URN, URN> > > GetSportEventsForDateAsync(DateTime date, CultureInfo culture) { RecordCall("GetSportEventsForDateAsync"); var filePath = GetFile(ScheduleXml, culture); var restDeserializer = new Deserializer <scheduleEndpoint>(); var mapper = new DateScheduleMapperFactory(); var stream = FileHelper.OpenFile(filePath); var result = mapper.CreateMapper(restDeserializer.Deserialize(stream)).Map(); await ExecuteDelayAsync(date.ToString("yyyy-M-d"), culture).ConfigureAwait(false); if (result != null) { await LogSaveDtoAsync(URN.Parse($"sr:sport_events:{result.Items.Count()}"), result, culture, DtoType.SportEventSummaryList, null).ConfigureAwait(false); var urns = new List <Tuple <URN, URN> >(); foreach (var item in result.Items) { urns.Add(new Tuple <URN, URN>(item.Id, item.SportId)); } return(urns.AsEnumerable()); } return(null); }
public async Task <IEnumerable <Tuple <URN, URN> > > GetLiveSportEventsAsync(CultureInfo culture) { RecordCall("GetLiveSportEventsAsync"); var filePath = GetFile("live_events.xml", culture); var restDeserializer = new Deserializer <scheduleEndpoint>(); var mapper = new DateScheduleMapperFactory(); var stream = FileHelper.OpenFile(filePath); var result = mapper.CreateMapper(restDeserializer.Deserialize(stream)).Map(); if (result != null) { await _cacheManager.SaveDtoAsync(URN.Parse($"sr:sport_events:{result.Items.Count()}"), result, culture, DtoType.SportEventSummaryList, null).ConfigureAwait(false); var urns = new List <Tuple <URN, URN> >(); foreach (var item in result.Items) { urns.Add(new Tuple <URN, URN>(item.Id, item.SportId)); } return(urns.AsEnumerable()); } return(null); }