Ejemplo n.º 1
0
        public async Task CollectShowsWithCast()
        {
            if (await _showService.Count() > 0)
            {
                return;
            }

            try
            {
                var ids = new List <int>();

                // Todo: This should be replaced by a better way of fetching all shows
                for (var i = 1; i < 999999; i++)
                {
                    ids.Add(i);
                }

                await Task.WhenAll(ids.Select(GetShowWithCast));

                await _showService.Add(new List <Show>(_shows.Select(x => (Show)x)));
            }
            catch (Exception ex)
            {
                _logger.LogError($"An error occured getting tv shows {ex}");
            }
        }