Пример #1
0
 public List<string> GetUserActiveGames(string userId)
 {
     var user = new User(userId);
     var findQ = BooleanOperator.Or(new[]
     {
         Query.Property("status").IsEqualTo(GameStatus.Waiting.ToString()),
         Query.Property("status").IsEqualTo(GameStatus.Started.ToString()),
         Query.Property("status").IsEqualTo(GameStatus.Invited.ToString())
     });
     var gameArticles = user.GetAllConnectedArticles(Relations.GamePlayer, findQ.ToString(), "game", new [] {"__id"});
     return gameArticles.Select( g => g.Id).ToList();
 }
Пример #2
0
 public List<Game> GetPreviousGames(string userId)
 {
     List<Game> games = new List<Game>();
     var user = new User(userId);
     var findQ = BooleanOperator.Or(new[]
     {
         Query.Property("status").IsEqualTo(GameStatus.Finished.ToString()),
         Query.Property("status").IsEqualTo(GameStatus.Resigned.ToString()),
         Query.Property("status").IsEqualTo(GameStatus.Cancelled.ToString())
     });
     var gameArticles = user.GetAllConnectedArticles(Relations.GamePlayer, findQ.ToString(), "game", new[] { "__id" });
     games = GetGameInfo(gameArticles.Select(g => g.Id));
     return games;
 }