コード例 #1
0
        private async Task <List <TeamAthletesView> > CreateTeamAndAthletes(
            List <Athlete> athletes,
            int quantityOfTeams,
            int numberAthletes,
            int numberPlayersTeam,
            int peladaId)
        {
            List <TeamAthletesView> teamAthletes = new List <TeamAthletesView>();

            this.stackOfAthletes = athleteRepository.CreateStackOfAthletes(athletes);

            int numberAthletesPerTeam =
                this.GetNumberAthletesPerTeam(
                    numberAthletes, quantityOfTeams, numberPlayersTeam);

            for (int i = 0; i < quantityOfTeams; i++)
            {
                var team = await teamRepository.CreateAndReturnTeam(new Team
                {
                    Name     = String.Format("Time {0}", i),
                    PeladaId = peladaId
                });


                List <string> athleteNames =
                    await CreateAthletes(numberAthletesPerTeam, team.Id);

                teamAthletes.Add(new TeamAthletesView
                {
                    TeamId       = team.Id,
                    TeamName     = team.Name,
                    AthleteNames = athleteNames
                });
            }

            return(teamAthletes);
        }