示例#1
0
 public List<Villain> Get()
 {
     try
     {
         return _blc.GetVillains();
     }
     catch(Exception ex)
     {
         throw new HttpRequestException(ex.Message);
     }
 }
        public async Task <VillainDeck> GetVillainDeck(Filter filter)
        {
            var rules = new List <Rule>();

            var scheme = await _schemeBLC.GetScheme(filter);

            Console.WriteLine($"Scheme: {scheme.Name}");
            rules = AddRules(rules, scheme);

            filter = ApplySetupRules(filter, scheme);

            var masterminds = await _mastermindBLC.GetMasterminds(filter, rules);

            foreach (var mastermind in masterminds)
            {
                Console.WriteLine($"Mastermind: {mastermind.Name}");
                rules = AddRules(rules, mastermind);
            }

            var villains = await _villainBLC.GetVillains(filter, rules);

            foreach (var villain in villains)
            {
                Console.WriteLine($"Villain: {villain.Name}");
                rules = AddRules(rules, villain);
            }

            var henchmen = await _henchmanBLC.GetHenchmen(filter, rules);

            foreach (var henchman in henchmen)
            {
                Console.WriteLine($"Henchman: {henchman.Name}");
                rules = AddRules(rules, henchman);
            }


            var villainDeck = new VillainDeck
            {
                Filter      = filter,
                Scheme      = scheme,
                Masterminds = masterminds,
                Villains    = villains,
                Henchmen    = henchmen
            };

            return(villainDeck);
        }