예제 #1
0
        public async Task <IEnumerable <Team> > GetTeams(GameId id, Deck deck)
        {
            var game = await context.Games
                       .Include(x => x.Teams)
                       .ThenInclude(x => x.Points)
                       .FirstOrDefaultAsync(x => x.Id == id);

            return(game.Teams.Select(x =>
            {
                var team = new Team(x.Color, x.TeamName);
                foreach (var point in x.Points)
                {
                    var concept = deck.SearchConcept(new ConceptId(point.Concept));
                    team.AddPoint(concept, point.Round);
                }
                foreach (var i in Enumerable.Range(0, team.Fails))
                {
                    team.AddFailure();
                }
                return team;
            }));
        }