public IActionResult Index() { var game = new Game(); repo.SaveGame(game); return(new ObjectResult(game.ToDto())); }
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())); }