public async Task <ActionResult <GameDto> > GetLastGame() { var game = (await _gameService.GetAllAsync()) .OrderByDescending(x => x.Id) .First(); return(GameDto.FromGame(game)); }
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()); }
public async Task <ActionResult <IEnumerable <GameDto> > > GetWaitingGames() => await _context.Games .Where(x => x.Status == 0) .Select(x => GameDto.FromGame(x)) .ToListAsync();
public async Task <ActionResult <IEnumerable <GameDto> > > GetGames() => await _context.Games .Select(x => GameDto.FromGame(x)) .ToListAsync();