using System; using EFLib; using Model; namespace DataManagers { public static class ChampChanger { public static Champion ToPoco(this ChampionEntity champion) { return new Champion(name: champion.Name, champClass: champion.ChampClass, icon: champion.Icon, bio: champion.Bio); } public static ChampionEntity ToEntity(this Champion champion) => new ChampionEntity { Name = champion.Name, Bio = champion.Bio, Icon = champion.Icon, ChampClass = champion.Class, //Characteristics = champion.Characteristics.Select(dict => dict).ToDictionary(pair => pair.Key, pair => pair.Value) }; public static IEnumerable ToPocos(this IEnumerable champs) { List champions = new List(); foreach (ChampionEntity c in champs) { champions.Add(c.ToPoco()); } return champions; } public static IEnumerable toEntities(this IEnumerable champs) { List champions = new List(); foreach (Champion c in champs) { champions.Add(c.ToEntity()); } return champions; } } }