本文整理汇总了C#中RepositoryFactory.GetNationalSuperCup方法的典型用法代码示例。如果您正苦于以下问题:C# RepositoryFactory.GetNationalSuperCup方法的具体用法?C# RepositoryFactory.GetNationalSuperCup怎么用?C# RepositoryFactory.GetNationalSuperCup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepositoryFactory
的用法示例。
在下文中一共展示了RepositoryFactory.GetNationalSuperCup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSchedule
public CompetitionSchedule CreateSchedule(Team team1, Team team2, Season season, MatchDateManager matchDateManager)
{
var competitionSchedule = new CompetitionSchedule();
using (var competitionRepository = new RepositoryFactory().CreateCompetitionRepository())
{
// Create a super cup season competition and round and save it to the database.
var superCupCompetition = competitionRepository.GetNationalSuperCup();
var superCupSeasonCompetition = new SeasonCompetition
{
Competition = superCupCompetition,
Season = season
};
competitionSchedule.SeasonCompetitions.Add(superCupSeasonCompetition);
const int roundNr = 0;
var superCupRound = new Round
{
Id = IdGenerator.GetId(),
Name = "Super Cup Final",
SeasonCompetition = superCupSeasonCompetition,
Order = roundNr,
CompetitionName = "Super Cup",
CompetitionType = CompetitionType.NationalSuperCup
};
competitionSchedule.Rounds.Add(superCupRound);
// Create the super cup match and save it to the database.
var teams1 = new List<Team> { team1 };
var teams2 = new List<Team> { team2 };
var singleRoundTournamentManager = new SingleRoundTournamentManager();
var match = singleRoundTournamentManager.GetMatches(teams1, teams2).Single();
match.Season = season;
match.Round = superCupRound;
match.Date = matchDateManager.GetNextMatchDate(CompetitionType.NationalSuperCup, roundNr);
match.DrawPermitted = false;
competitionSchedule.Matches.Add(match);
// Add both teams to the super cup competition of this season.
var seasonCompetitionTeam1 = new SeasonCompetitionTeam
{
Team = team1,
SeasonCompetition = superCupSeasonCompetition
};
var seasonCompetitionTeam2 = new SeasonCompetitionTeam
{
Team = team2,
SeasonCompetition = superCupSeasonCompetition
};
competitionSchedule.SeasonCompetitionTeams.Add(seasonCompetitionTeam1);
competitionSchedule.SeasonCompetitionTeams.Add(seasonCompetitionTeam2);
}
return competitionSchedule;
}