Exemple #1
0
        public static List <Dictionary <string, object> > ToDictionaryList(GamePlatformList gameGenreList)
        {
            var result = new List <Dictionary <string, object> >();

            try
            {
                if (gameGenreList?.List?.Count > 0)
                {
                    result = (from gamegenre in gameGenreList.List where gamegenre != null select GamePlatform.ToDictionary(gamegenre) into dictionary where dictionary?.Count > 0 select dictionary).ToList();
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
            return(result);
        }
Exemple #2
0
        public static GamePlatformList FromDictionaryList(List <Dictionary <string, object> > dictionaryList)
        {
            var result = new GamePlatformList();

            try
            {
                if (dictionaryList?.Count > 0)
                {
                    foreach (var dataDictionary in dictionaryList.Where(dataDictionary => dataDictionary?.Count > 0))
                    {
                        result.List.Add(GamePlatform.FromDictionary(dataDictionary));
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
            return(result);
        }