You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.3 KiB
45 lines
1.3 KiB
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<Champion> ToPocos(this IEnumerable<ChampionEntity> champs)
|
|
{
|
|
List<Champion> champions = new List<Champion>();
|
|
foreach (ChampionEntity c in champs)
|
|
{
|
|
champions.Add(c.ToPoco());
|
|
}
|
|
return champions;
|
|
}
|
|
|
|
public static IEnumerable<ChampionEntity> toEntities(this IEnumerable<Champion> champs)
|
|
{
|
|
List<ChampionEntity> champions = new List<ChampionEntity>();
|
|
foreach (Champion c in champs)
|
|
{
|
|
champions.Add(c.ToEntity());
|
|
}
|
|
return champions;
|
|
}
|
|
}
|
|
}
|
|
|