public static List <Link> GetGameFamilies(this Game game)
 {
     return(game
            .GetGameItem()
            .Link
            .Where(link =>
                   string.Equals(link.Type, BOARDGAME_FAMILY) &&
                   !string.Equals(link.Value, ADMIN_NOT_TO_ADD))
            .ToList());
 }
        public static int GetId(this Game game)
        {
            var item = game.GetGameItem();

            if (item == null)
            {
                throw new NullReferenceException("Game item returned null");
            }

            return(int.Parse(item.Id));
        }
        // Methods to get internal objects / properties
        private static string GetValue(this Game game, string propName)
        {
            var gameItem = game.GetGameItem();

            var obj = gameItem
                      .GetType()
                      .GetProperty(propName)
                      ?.GetValue(gameItem, null);

            return(obj?
                   .GetType()
                   .GetProperty("Value")
                   ?.GetValue(obj, null) as string);
        }
 public static double GetMinAge(this Game game)
 {
     return(SafeGetValue(game.GetValue("Minage")));
 }
 public static double GetMaxPlayTime(this Game game)
 {
     return(SafeGetValue(game.GetValue("Maxplaytime"), double.MaxValue));
 }
 public static double GetMinPlayTime(this Game game)
 {
     return(SafeGetValue(game.GetValue("Minplaytime")));
 }
 public static double GetPlayingTime(this Game game)
 {
     return(SafeGetValue(game.GetValue("Playingtime"), double.MaxValue));
 }
 public static double GetMaxPlayers(this Game game)
 {
     return(SafeGetValue(game.GetValue("Maxplayers")));
 }
 public static double GetWishing(this Game game)
 {
     return(Double.Parse(game.GetStatistics().Wishing.Value));
 }
 public static double GetOwned(this Game game)
 {
     return(Double.Parse(game.GetStatistics().Owned.Value));
 }
 private static Ratings GetStatistics(this Game game)
 {
     return(game.GetGameItem().Statistics.Ratings);
 }
 private static Item GetGameItem(this Game game)
 {
     return(game.Item);
 }
 public static List <Link> GetGameMechanics(this Game game)
 {
     return(game.GetGameItem().Link.Where(link => string.Equals(link.Type, BOARDGAME_MECHANIC)).ToList());
 }
 public static List <Link> GetGameCategories(this Game game)
 {
     return(game.GetGameItem().Link.Where(link => string.Equals(link.Type, BOARDGAME_CATEGORY)).ToList());
 }
 public static double GetAverageWeight(this Game game)
 {
     return(SafeDoubleSeparator(game.GetStatistics().Averageweight.Value));
 }
 public static string GetName(this Game game)
 {
     return(game.GetGameItem()?.Name.FirstOrDefault(name => string.Equals(name.Type, PRIMARY_NAME))?.Value);
 }
 public static double GetNumComments(this Game game)
 {
     return(double.Parse(game.GetStatistics().Numcomments.Value));
 }
 public static double GetYearPublished(this Game game)
 {
     return(SafeGetValue(game.GetValue("Yearpublished")));
 }
 public static double GetNumWeights(this Game game)
 {
     return(Double.Parse(game.GetStatistics().Numweights.Value));
 }
 public static double GetUsersRated(this Game game)
 {
     return(Double.Parse(game.GetStatistics().Usersrated.Value));
 }