public JsonResult NewGame(string user, string hostPlayer = "", bool multiplayer = false) { var game = new Game.Game(); Response response; response = string.IsNullOrEmpty(hostPlayer) ? game.StartNewGame(user, multiplayer) : game.JoinAMultiplayerMatch(hostPlayer, user); var returnObject = new { colors = response.Colors, code_length = response.Code_length, game_key = response.Game_key, num_guesses = response.Num_guesses, past_results = response.Past_results, solved = response.Solved, error = response.Error, multiplayer = response.Multiplayer }; return(Json(returnObject, JsonRequestBehavior.DenyGet)); }