internal async static Task SendCurrentGame(IHubContext <MessageHub> hubContext, SignalRGame currentGame) { await hubContext.Clients.All.SendAsync(SignalRTopics.GameCurrent, currentGame); }
internal async static Task SendAllPendingGames(IHubContext <MessageHub> hubContext, List <Gamer> gamers, SignalRGame currentGame) { var games = gamers .Where(f => f.Games.Any(st => st.State == GameState.Pending)) .Where(f => currentGame == null || currentGame.Id != f.Id) .OrderBy(f => f.Games.Where(g => g.State == GameState.Pending).Max(g => g.DateCreated)) .Select(f => new SignalRGame(f.Id, f.DisplayName, 0, 0, 3)).ToList(); await hubContext.Clients.All.SendAsync(SignalRTopics.GamesPending, games); }