public IActionResult JoinPost(int id) { Spel spel = _spelService.GetSpel(id); if (_spelService.GetSpellen(_authService.Get()).Count(x => !x.Afgelopen() && !x.Cancelled) > 0) { return(new RedirectResult("/game")); } if (spel.Speler2 != null || spel.Afgelopen() || spel.Cancelled) { return(new RedirectResult("/game")); } spel = _spelService.JoinSpel(spel); return(new RedirectResult($"/index.html?token={Base64UrlEncoder.Encode(spel.Speler2Token)}")); }