Esempio n. 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);
 }
Esempio n. 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));
        }
 public LeaderBoardService(WhozitEntities context)
 {
     _context = context;
 }
 //
 // GET: /LeaderBoard/
 public IEnumerable<LeaderBoard> Get()
 {
     WhozitEntities context = new WhozitEntities();
     ILeaderBoardService leaderBoardService = new LeaderBoardService(context);
     return leaderBoardService.GetLeaderBoardByPoints(10);
 }
Esempio n. 5
0
 public GameService(WhozitEntities context, INotificationService notificationService, IGamePiecesService gamePieceService)
 {
     _context = context;
     _notificationService = notificationService;
     _gamePiecesService = gamePieceService;
 }
Esempio n. 6
0
 public GamePiecesService(WhozitEntities context)
 {
     _context = context;
 }
Esempio n. 7
0
 public GamePiecesService()
 {
     _context = new WhozitEntities();
 }