Exemple #1
0
        public async Task InitializeData()
        {
            var tvMazeShows = await GetTvMazeShows();

            var dbShows = new List <Show>();

            foreach (var tvMazeShow in tvMazeShows)
            {
                var cast = await GetTvMazeCast(tvMazeShow);

                dbShows.Add(new Show
                {
                    TvMazeId = tvMazeShow.Id,
                    Name     = tvMazeShow.Name,
                    Cast     = cast
                });
            }

            await _showsRepository.AddMany(dbShows.ToArray());
        }