Ejemplo n.º 1
0
        private async Task ImportSeriesExternalIds()
        {
            for (var index = 0; index < _importSeriesIds.Count; index++)
            {
                var seriesId = _importSeriesIds.ElementAt(index);

                var seriesExternalIdsJson = await _movieDbApi.GetSeriesExternalIds(seriesId);

                if (seriesExternalIdsJson != null)
                {
                    var seriesFromImport = _movieDbDomainConverter.ConvertToSeriesWithExternalIds(seriesExternalIdsJson);

                    var seriesFromDb = await _tvSeriesContext
                                       .Series
                                       .Where(x => x.MovieDbId == seriesId)
                                       .FirstOrDefaultAsync();

                    await _movieDbImportServiceDbHelper.UpdateSeriesExternalIds(seriesFromDb, seriesFromImport);
                }
                else
                {
                    _logger.LogInformation("Series with MovieDbId [{0}] not found", seriesId);
                }
            }
        }