Exemple #1
0
        private async Task ImportPersonsDetails()
        {
            for (var index = 0; index < _importPersonsIds.Count; index++)
            {
                var personId = _importPersonsIds.ElementAt(index);

                var personJson = await _movieDbApi.GetPersonDetails(personId);

                if (personJson != null)
                {
                    var personFromImport = _movieDbDomainConverter.ConvertToPerson(personJson);

                    var poster = await _movieDbApi.GetImage(personFromImport.PosterName);

                    personFromImport.PosterContent = poster;

                    var personFromDb = await _tvSeriesContext
                                       .Persons
                                       .Where(x => x.MovieDbId == personId)
                                       .FirstOrDefaultAsync();


                    await _movieDbImportServiceDbHelper.AddOrUpdate(personFromDb, personFromImport);
                }
                else
                {
                    _logger.LogInformation("Person with MovieDbId [{0}] not found", personId);
                }
            }
        }