public static List <Dictionary <string, object> > ToDictionaryList(GameGenreList gameGenreList) { var result = new List <Dictionary <string, object> >(); try { if (gameGenreList?.List?.Count > 0) { result = (from gamegenre in gameGenreList.List where gamegenre != null select GameGenre.ToDictionary(gamegenre) into dictionary where dictionary?.Count > 0 select dictionary).ToList(); } } catch (Exception ex) { Log.Error(ex); } return(result); }
public static GameGenreList FromDictionaryList(List <Dictionary <string, object> > dictionaryList) { var result = new GameGenreList(); try { if (dictionaryList?.Count > 0) { foreach (var dataDictionary in dictionaryList.Where(dataDictionary => dataDictionary?.Count > 0)) { result.List.Add(GameGenre.FromDictionary(dataDictionary)); } } } catch (Exception ex) { Log.Error(ex); } return(result); }