public IActionResult createGame([FromBody] Game newGame)
    {
        var returnValue = gameMethods.CreateGame(newGame);

        if (returnValue != null)
        {
            return(Created("Created:", returnValue));
        }
        else
        {
            return(NotFound());
        }
    }
Exemplo n.º 2
0
        public GameModel CreateGameHandler(string Player_Name)
        {
            var game = GameMethods.CreateGame();

            var player = PlayerMethods.CreatePlayer(HttpContext.Session.SessionID, game.Id, Player_Name);

            // Add the player Id to the game
            game.Player_Ids = "," + player.Id;
            HttpContext.Application["Game-" + game.Id] = game;

            player.Game_Id = game.Id;
            HttpContext.Application["Player-" + player.Id] = player;

            Session["Game_Id"] = game.Id;
            // new Hubs.GameHub().JoinGroup(game.Id.ToString());

            return(game);
        }