Exemple #1
0
 public dbMatch WithPlayerOneAs(int playerID)
 {
     if (Player1ID == playerID)
     {
         var newMatch = new dbMatch();
         newMatch.Copy(this);
         return(newMatch);
     }
     else if (Player2ID != playerID)
     {
         throw new ArgumentException("Player not found in match, can't set player as PlayerOne");
     }
     else
     {
         var newMatch = new dbMatch()
         {
             Player1ID   = Player1ID,
             Player2ID   = Player2ID,
             Player1     = Player2,
             Player2     = Player1,
             Event       = Event,
             Round       = Round,
             Player1Wins = Player2Wins,
             Player2Wins = Player1Wins,
             Draws       = Draws
         };
         return(newMatch);
     }
 }
Exemple #2
0
 public void Copy(dbMatch m)
 {
     this.Player1ID   = m.Player1ID;
     this.Player2ID   = m.Player2ID;
     this.Player1     = m.Player1;
     this.Player2     = m.Player2;
     this.Event       = m.Event;
     this.Round       = m.Round;
     this.Player1Wins = m.Player1Wins;
     this.Player2Wins = m.Player2Wins;
     this.Draws       = m.Draws;
 }
Exemple #3
0
 public Match(dbMatch m)
     : this(m.Player1ID, m.Player2ID, m.Event, m.Round, m.Player1Wins, m.Player2Wins, m.Draws)
 {
     myDbMatch = m;
 }