Beispiel #1
0
        internal static MatchListItem Map(DAL.Entities.Match match, IEnumerable <DAL.Entities.Team> teams, IEnumerable <DAL.Entities.Player> players)
        {
            var yellowTeam = Map(teams.Single(x => x.Id == match.TeamYellow), players);
            var redTeam    = Map(teams.Single(x => x.Id == match.TeamRed), players);

            var winner = match.WinnerTeamId == match.TeamYellow
                ? "yellow"
                : "red";

            return(new MatchListItem(
                       match.Id,
                       yellowTeam,
                       redTeam,
                       match.TeamYellowScore,
                       match.TeamRedScore,
                       winner,
                       match.PlayedOn,
                       match.Note
                       ));
        }
Beispiel #2
0
 public static Models.Match Map(DAL.Entities.Match match)
 => new Models.Match(match.Id, match.TeamYellow, match.TeamRed, match.TeamYellowScore, match.TeamRedScore, match.Note);