public static RoundModel Build(IEnumerable <Fight> fights, int roundNumber) { var roundModel = new RoundModel(); roundModel.RoundNumber = roundNumber; foreach (var fight in fights) { var fightModel = new FightModel(); fightModel.Team1 = TeamModel.Build(fight.Teams[0]); fightModel.Team2 = TeamModel.Build(fight.Teams[1]); roundModel.Fight.Add(fightModel); } return(roundModel); }
public static TournamentModel Build(Tournament tournament) { var tournamentModel = new TournamentModel(); if (tournament != null) { var rounds = tournament.GetRounds(); foreach (var round in rounds) { tournamentModel.Round.Add(RoundModel.Build(round.Fights, round.RoundNumber)); } var teamWinner = tournament.GetWinnerTournament(); if (teamWinner != null) { tournamentModel.Winner = teamWinner.Kingdom; } } return(tournamentModel); }