コード例 #1
0
        public static async Task SplitSuperPoweredPeople(IAllSuperPoweredRepository repo,
                                                         IEnumerable <IIdentifierService> identifierServices)
        {
            if (repo == null)
            {
                throw new ArgumentNullException(nameof(repo));
            }
            else if (identifierServices == null)
            {
                throw new ArgumentNullException(nameof(identifierServices));
            }
            else if (identifierServices.Count() == 0)
            {
                throw new ArgumentException("Service collection must not be empty.", nameof(identifierServices));
            }

            var names = await repo.GetAsync();

            if (names.Count() > 0)
            {
                foreach (var name in names)
                {
                    identifierServices.FirstOrDefault(x => x.IsMatch(name)).Add(name);
                }

                foreach (var service in identifierServices)
                {
                    await service.Save();
                }
            }
        }
コード例 #2
0
 public SuperPoweredPeopleController(IAllSuperPoweredRepository allRepo,
                                     ISuperHeroRepository heroRepo, IVillainRepository villainRepo, ILogger logger)
 {
     this.allRepo     = allRepo;
     this.heroRepo    = heroRepo;
     this.villainRepo = villainRepo;
     this.logger      = logger;
 }