Пример #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));
        }
Пример #3
0
 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);
 }
Пример #5
0
 public GameService(WhozitEntities context, INotificationService notificationService, IGamePiecesService gamePieceService)
 {
     _context = context;
     _notificationService = notificationService;
     _gamePiecesService = gamePieceService;
 }
Пример #6
0
 public GamePiecesService(WhozitEntities context)
 {
     _context = context;
 }
Пример #7
0
 public GamePiecesService()
 {
     _context = new WhozitEntities();
 }