Ejemplo n.º 1
0
        public async Task <ActionResult> Destroy(string token)
        {
            string data = await _cache.GetStringAsync($"{AppConstants.RegistrationCachePrefix}{token}");

            if (string.IsNullOrEmpty(data))
            {
                return(Ok());
            }

            var registration = JsonSerializer.Deserialize <Registration>(data);

            var result = await _gamespaceService.Destroy(registration.GamespaceId);

            if (result != null)
            {
                Log("destroyed", result);

                SendBroadcast(result, "OVER");
            }

            await _cache.RemoveAsync($"{AppConstants.RegistrationCachePrefix}{token}");

            if (User.Identity.AuthenticationType == AppConstants.CookieScheme)
            {
                await HttpContext.SignOutAsync(AppConstants.CookieScheme);
            }

            return(Ok());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Destroy(int id)
        {
            var result = await _gamespaceService.Destroy(id);

            Log("destroyed", result);

            SendBroadcast(result, "OVER");

            return(Ok());
        }