Esempio n. 1
0
 public static TeamModel From(Team team)
 {
     if (team == null)
         return null;
     return new TeamModel
     {
         Id = team.Id,
         Name = team.Name,
         Players = team.Players.Select(PlayerModel.From).ToList()
     };
 }
Esempio n. 2
0
 public Task<Team> SetState(Team team, EntityState entityState)
 {
     _matchContext.Entry(team).State = entityState;
     return Task.FromResult(team);
 }
        private ICollection<Team> CreateTeams(int nbTeams, int playersByTeam = 2)
        {
            var teams = new List<Team>();
            for (int i = 0; i < nbTeams; i++)
            {
                var team = new Team{Players = new Collection<Player>()};

                for (int j = 0; j < playersByTeam; j++)
                    team.Players.Add(new Player {Matricule = (i*j + j).ToString(CultureInfo.InvariantCulture)});

                teams.Add(team);
            }
            return teams;
        }