Пример #1
0
 //
 // GET: /api/game
 public IEnumerable<Game> Get(long facebookId, string token)
 {
     var context = new WhozitEntities();
     var notificationService = new FacebookNotificationService(token);
     var gamePiecesService = new GamePiecesService();
     var gameService = new GameService(context, notificationService, gamePiecesService);
     return gameService.GetGames(facebookId);
 }
Пример #2
0
        //
        // POST: /api/game
        public void Post(long facebookId, string token)
        {
            var context = new WhozitEntities();
            var notificationService = new FacebookNotificationService(token);
            var gamePiecesService = new GamePiecesService();
            var gameService = new GameService(context, notificationService, gamePiecesService);
            var invited = gameService.InviteRandomOpponent(facebookId);

            if (!invited) //no one was found, throw a not found exception
                throw new HttpResponseException(new HttpResponseMessage(System.Net.HttpStatusCode.NotFound));
        }