Exemplo n.º 1
0
        public IActionResult Index()
        {
            var game = new Game();

            repo.SaveGame(game);
            return(new ObjectResult(game.ToDto()));
        }
Exemplo n.º 2
0
        public IActionResult Moves(Guid gameId, [FromBody] UserInputForMovesPost userInput)
        {
            var directionRaw = userInput.KeyPressed;
            var game         = repo.GetGame();

            if (!directions.ContainsKey(directionRaw))
            {
                return(new ObjectResult(game.ToDto()));
            }

            var direction = directions[directionRaw];

            game.UpdateBoard(direction);
            repo.SaveGame(game);

            return(new ObjectResult(game.ToDto()));
        }