Exemplo n.º 1
0
 public GameBDO VerifyGameResult(NotificationConfirmation notificationConfirmation)
 {
     var gameToUpdate = _gameRepository.GetGame(notificationConfirmation.GameId);
     if (gameToUpdate.PlayerOneLogin == notificationConfirmation.ConfirmingUserLogin)
     {
         gameToUpdate.PlayerOneConfirmed = true;
         _gameRepository.UpdateGame(gameToUpdate);
     }
     else if (gameToUpdate.PlayerTwoLogin == notificationConfirmation.ConfirmingUserLogin)
     {
         gameToUpdate.PlayerTwoConfirmed = true;
         _gameRepository.UpdateGame(gameToUpdate);
     }
     else
     {
         throw new ArgumentException("The game was not played by " + notificationConfirmation.ConfirmingUserLogin);
     }
     return gameToUpdate;
 }
Exemplo n.º 2
0
 public HttpResponseMessage VerifyGameResult(NotificationConfirmation notificationConfirmation)
 {
     try
     {
         var updatedGame = _gamesProvider.VerifyGameResult(notificationConfirmation);
         return Request.CreateResponse(HttpStatusCode.OK, updatedGame);
     }
     catch (Exception exception)
     {
         throw new ArgumentException("Failed to verify a game.", exception.InnerException);
     }
 }