public JsonResult Index(int id, string passphrase, Entities.Enums.GamePlayerType playerType)
{
bool validated = false;
validated = _validatePassphrase.Execute(id, passphrase);
string key = string.Format("Game_{0}_Passphrase", id);
if (validated && !string.IsNullOrWhiteSpace(passphrase))
{
Session.Add(key, MachineKey.Protect(Encoding.ASCII.GetBytes(passphrase), Session.SessionID));
}
string url = Url.Action("Index", "Game", new { id = id });
if (playerType == Entities.Enums.GamePlayerType.Spectator)
{
url = Url.Action("Spectate", "Game", new { id = id });
}
return Json(new { Validated = validated, URL = url });
}