Esempio n. 1
0
        public void SyncCards()
        {
            var sets = _db.Sets().OrderBy(s => s.ReleasedAt);

            foreach (var dbSet in sets)
            {
                if (dbSet.Completed == false)
                {
                    System.Console.WriteLine($"attempting to sync cards for the set {dbSet.Name}");
                    var cards = _scryfall.GetBySet(dbSet.Code).ToList();
                    System.Console.WriteLine($"syncing {dbSet.CardCount} cards for the set {dbSet.Name}");
                    foreach (var card in cards)
                    {
                        _db.AddCard(CardMapper.SharedToDb(card), SetMapper.SharedToDb(dbSet));
                    }
                    _db.CompleteSet(dbSet);
                }
                else
                {
                    System.Console.WriteLine($"Skipping the set {dbSet.Name}");
                }
            }
        }