using System; using EFLib; using Model; namespace DataManagers { public static class ChampChanger { public static Champion ToPoco(this ChampionEntity champion) { return new Champion(id: champion.Id, name: champion.Name, champClass: champion.ChampClass, icon: champion.Icon, bio: champion.Bio, image: champion.LargeImage.Base64, imageId: champion.ImageId); } public static ChampionEntity ToEntity(this Champion champion) => new ChampionEntity { Id = champion.Id, Name = champion.Name, Bio = champion.Bio, Icon = champion.Icon, ChampClass = champion.Class, ImageId = champion.Image.Id, LargeImage = champion.Image.ToEntity() }; 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; } } }