public async Task <ITeamResultEngine> GetEngine(IResultsEngineRequest request) { this._unitOfWork.GuardCheckInTransaction(); await this._competitionRepository.GetForUpdate(request.CompetitionID); Entities.Competition competition = await this._competitionRepository.GetWithStages(request.CompetitionID); CompetitionStage stage = this.GetStage(competition, request.CompetitionStageLoadMode, request.CompetitionStageValue); TeamFixture fixture = await this._fixtureRepository.GetTeamFixtureFull(request.FixtureID); if (fixture.CompetitionRound.Competition.ID != competition.ID) { throw new ArgumentException("Incorrect competition/fixture ID combination", nameof(request)); } ITeamFixtureModel teamFixtureModel = this._serviceProvider.GetService <ITeamFixtureModel>(); ITeamResultEngineContext context = this._serviceProvider.GetService <ITeamResultEngineContext>(); await context.Initialise(competition, stage, fixture.CompetitionRound.CompetitionEvent, fixture.CompetitionRound, teamFixtureModel); var engine = this._serviceProvider.GetService <ITeamResultEngine>(); engine.SetContext(context); await teamFixtureModel.Initialise(fixture, context); return(engine); }
public async Task Initialise(Entities.Competition competition, CompetitionStage stage, CompetitionEvent competitionEvent, CompetitionRound round, ITeamFixtureModel teamFixture) { this.Competition = competition; this.CompetitionStage = stage; this.CompetitionEvent = competitionEvent; this.CompetitionRound = round; this.Fixture = teamFixture; }