public async Task <List <Showing> > GetCommonData(Cities city) { List <Showing> commonShowings = new List <Showing>(); var data = await _dataProviderService.GetCurrentData <MultiKinoShowing>(city); var cinemas = _dataProviderService.GetCityInfo(); var cinemaIndex = 0; foreach (var cinema in cinemas) { foreach (var film in data[cinemaIndex].Films) { foreach (var time in film.Showings.SelectMany(f => f.Times)) { var showing = new Showing() { Movie = new Movie() { Description = film.SynopsisShort, Duration = film.InfoRunningtime, Tittle = film.Title }, CinemaInfo = new CinemaInfo() { City = city, Company = "MultiKino", Name = cinema.Name }, Date = time.Date.ToString("dd MMMM yyyy"), BeginsAt = time.Date.ToString("HH:mm"), ShowingType = film.PromoLabels.Names.Select(n => n.Name).FirstOrDefault() }; commonShowings.Add(showing); } } cinemaIndex++; } return(commonShowings); }
public async Task <ParsedDataModel> Handle(GetLatestData request, CancellationToken cancellationToken) { return(await _dataService.GetCurrentData()); }