Exemplo n.º 1
0
        public async Task <ActionResult <GameDto> > GetLastGame()
        {
            var game = (await _gameService.GetAllAsync())
                       .OrderByDescending(x => x.Id)
                       .First();

            return(GameDto.FromGame(game));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <GameDto> > MakeMove(long gameId, string userId, string move)
        {
            var game = await _chessGameService.MakeMove(gameId, userId, move);

            var gameDto = GameDto.FromGame(game);

            return(gameDto ?? (ActionResult <GameDto>)NotFound());
        }
Exemplo n.º 3
0
 public async Task <ActionResult <IEnumerable <GameDto> > > GetWaitingGames() =>
 await _context.Games
 .Where(x => x.Status == 0)
 .Select(x => GameDto.FromGame(x))
 .ToListAsync();
Exemplo n.º 4
0
 public async Task <ActionResult <IEnumerable <GameDto> > > GetGames() =>
 await _context.Games
 .Select(x => GameDto.FromGame(x))
 .ToListAsync();