Exemplo n.º 1
0
        private async Task DangerouslyAcceptScheduleRequest(EF.Models.MatchSeriesScheduleRequest scheduleRequest)
        {
            if (scheduleRequest.MatchSeries != null)
            {
                var matchSeries = scheduleRequest.MatchSeries;
                matchSeries.ScheduledAt = scheduleRequest.ProposedTimeSlot;
                alexandriaContext.MatchSeries.Update(matchSeries);
                if (matchSeries.TournamentRoundId.HasValue)
                {
                    var tournamentId = (await alexandriaContext.Tournaments.FirstOrDefaultAsync(t => t.TournamentRounds.Any(tr => tr.Id == matchSeries.TournamentRoundId.Value)))?.Id;
                    if (tournamentId.HasValue)
                    {
                        var tournaments = (await this.tournamentUtils.GetTournamentParents(tournamentId.Value)).Select(t => t.Id);

                        foreach (var cacheBreakTournament in tournaments)
                        {
                            this.cacheBreaker.Break(Shared.Cache.Tournament.Schedule(cacheBreakTournament));
                        }
                    }
                }
            }
            else
            {
                throw new NotImplementedException("Creating a Match not yet supported");
            }

            scheduleRequest.Accept();

            alexandriaContext.MatchSeriesScheduleRequests.Update(scheduleRequest);
        }
Exemplo n.º 2
0
        private EF.Models.MatchSeriesScheduleRequest DangerouslyCreateScheduleRequest(Guid originTeamId, DTO.MatchSeries.CreateScheduleRequest payload)
        {
            var scheduleRequest = new EF.Models.MatchSeriesScheduleRequest(originTeamId, payload.TargetTeamId, payload.MatchType, payload.ProposedTimeSlot, payload.MatchSeriesId);

            this.alexandriaContext.MatchSeriesScheduleRequests.Add(scheduleRequest);

            return(scheduleRequest);
        }
Exemplo n.º 3
0
 private void DangerouslyRescindScheduleRequest(EF.Models.MatchSeriesScheduleRequest scheduleRequest)
 {
     scheduleRequest.Rescind();
     alexandriaContext.MatchSeriesScheduleRequests.Update(scheduleRequest);
 }
Exemplo n.º 4
0
 private void DangerouslyDeclineScheduleRequest(EF.Models.MatchSeriesScheduleRequest scheduleRequest)
 {
     scheduleRequest.Decline();
     alexandriaContext.MatchSeriesScheduleRequests.Update(scheduleRequest);
 }