/// <summary> /// Removes the games given from the event /// </summary> /// <param name="sender">The sender</param> /// <param name="args">The arguments</param> public void OnGamesDeleted(object sender, BracketEventArgs args) { foreach (int gameId in args.DeletedGameIDs) { services.Tournament.DeleteGame(gameId); } services.Save(); }
/// <summary> /// Updates the match that was given from an event /// </summary> /// <param name="sender">The sender</param> /// <param name="args">The arguments</param> public void OnRoundAdd(object sender, BracketEventArgs args) { foreach (MatchModel match in args.UpdatedMatches) { services.Tournament.AddMatch(match); } if (services.Save()) { roundsModified = true; } }
/// <summary> /// Updates the match that was given from an event /// </summary> /// <param name="sender">The sender</param> /// <param name="args">The arguments</param> public void OnRoundDelete(object sender, BracketEventArgs args) { foreach (int games in args.DeletedGameIDs) { services.Tournament.DeleteGame(games); } foreach (MatchModel match in args.UpdatedMatches) { services.Tournament.DeleteMatch(match.MatchID); } if (services.Save()) { roundsModified = true; } }
/// <summary> /// Updates the match that was given from an event /// </summary> /// <param name="sender">The sender</param> /// <param name="args">The arguments</param> public void OnMatchesUpdated(object sender, BracketEventArgs args) { foreach (MatchModel matchModel in args.UpdatedMatches) { //MatchModel match = model.Matches.Single(x => x.MatchNumber == matchModel.MatchNumber); //match.MatchID = matchModel.MatchID; //match.BracketID = matchModel.BracketID; //match.ChallengerID = matchModel.ChallengerID; //match.DefenderID = matchModel.DefenderID; //match.WinnerID = matchModel.WinnerID; //match.ChallengerScore = matchModel.ChallengerScore; //match.DefenderScore = matchModel.DefenderScore; //match.MatchIndex = matchModel.MatchIndex; //match.RoundIndex = matchModel.RoundIndex; //match.PrevMatchIndex = matchModel.PrevMatchIndex; //match.MatchNumber = matchModel.MatchNumber; //match.PrevDefenderMatchNumber = matchModel.PrevDefenderMatchNumber; //match.PrevChallengerMatchNumber = matchModel.PrevChallengerMatchNumber; //match.NextMatchNumber = matchModel.NextMatchNumber; //match.NextLoserMatchNumber = matchModel.NextLoserMatchNumber; //match.MaxGames = matchModel.MaxGames; //services.Tournament.UpdateMatch(match); services.Tournament.UpdateMatch(matchModel); } foreach (int games in args.DeletedGameIDs) { services.Tournament.DeleteGame(games); } services.Save(); }