public async Task <ActionResult <WorkspaceStats> > DeleteWorkspaceGames(string id) { await Validate(new Entity { Id = id }); AuthorizeAny( () => Actor.IsAdmin, () => _svc.CanEdit(id, Actor.Id).Result ); var games = await _svc.KillGames(id); List <Task> tasklist = new List <Task>(); foreach (var game in games) { tasklist.Add( Hub.Clients .Group(game.Id) .GameEvent(new BroadcastEvent <GameState>(User, "GAME.OVER", game)) ); } await Task.WhenAll(tasklist.ToArray()); return(Ok( await GetWorkspaceStats(id) )); }
public async Task <ActionResult> DeleteGames(int id) { var games = await _workspaceService.KillGames(id); List <Task> tasklist = new List <Task>(); foreach (var game in games) { tasklist.Add(_hub.Clients.Group(game.GlobalId).GameEvent(new BroadcastEvent <GameState>(User, "GAME.OVER", game))); } Task.WaitAll(tasklist.ToArray()); return(Ok()); }