Exemplo n.º 1
0
        private static string handleCreateGameRequest(NameValueCollection requestData)
        {
            var responseData = HttpUtility.ParseQueryString("");

            if (SessionList.IsValidSession(requestData["token"]) &&
                CreatedGameList.TryAddCreatedGame(new CreatedGame(requestData["gamename"], (requestData["usepincode"] == "1")?true:false, requestData["pincode"])))
            {
                responseData.Add("result", "success");
            }
            else
            {
                responseData.Add("result", "fail");
            }
            return(responseData.ToString());
        }
Exemplo n.º 2
0
        private static string handleJoinGameRequest(NameValueCollection requestData)
        {
            var responseData = HttpUtility.ParseQueryString("");
            var session      = SessionList.GetValidSession(requestData["token"]);
            var createdGame  = CreatedGameList.GetCreatedGame(requestData["gamename"]);

            if (session != null && createdGame != null)
            {
                if (LoggedInUserList.UpdateCurrentGamenameOnLoggedInUser(session.LoginUsername, requestData["gamename"]))
                {
                    responseData.Add("result", "success");
                }
                else
                {
                    responseData.Add("result", "fail");
                }
            }
            else
            {
                responseData.Add("result", "fail");
            }
            return(responseData.ToString());
        }
Exemplo n.º 3
0
 private static string handleListCreatedGameRequest(NameValueCollection requestData)
 {
     return(CreatedGameList.GetListAsJson());
 }