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.
100 lines
2.6 KiB
100 lines
2.6 KiB
using DTO;
|
|
using Model;
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EntityFramwork.Factories
|
|
{
|
|
public static class Factories
|
|
{
|
|
|
|
// Factorie Champion
|
|
public static EntityChampions ChampionModelToEntity(this Champion champ)
|
|
{
|
|
EntityChampions entity = new EntityChampions();
|
|
|
|
entity.Name = champ.Name;
|
|
entity.Bio = champ.Bio;
|
|
entity.Icon = champ.Icon;
|
|
entity.Classe = champ.Class.ToString();
|
|
|
|
return entity;
|
|
}
|
|
|
|
public static Champion EntityChampionToModele(this EntityChampions entity)
|
|
{
|
|
ChampionClass classe = ChampionClass.Unknown;
|
|
|
|
switch (entity.Classe)
|
|
{
|
|
case "Assassin":
|
|
classe = ChampionClass.Assassin;
|
|
break;
|
|
|
|
case "Fighter":
|
|
classe = ChampionClass.Fighter;
|
|
break;
|
|
|
|
case "Mage":
|
|
classe = ChampionClass.Mage;
|
|
break;
|
|
|
|
case "Support":
|
|
classe = ChampionClass.Support;
|
|
break;
|
|
|
|
case "Tank":
|
|
classe = ChampionClass.Tank;
|
|
break;
|
|
}
|
|
|
|
// Attention l'image !!
|
|
return new Champion(entity.Name,champClass:classe,icon:entity.Icon,bio:entity.Bio);
|
|
}
|
|
|
|
public
|
|
|
|
|
|
// Skins
|
|
public static EntitySkins SkinsModelToEntity(this Skin skin,int id)
|
|
{
|
|
EntitySkins entity= new EntitySkins();
|
|
|
|
entity.Price = skin.Price;
|
|
entity.Icon = skin.Icon;
|
|
entity.Name = skin.Name;
|
|
entity.Description = skin.Description;
|
|
entity.ChampionId = id;
|
|
|
|
return entity;
|
|
}
|
|
|
|
|
|
public static EntityRunes RuneModelToEntity(this Rune rune)
|
|
{
|
|
EntityRunes entity = new EntityRunes();
|
|
|
|
entity.Name= rune.Name;
|
|
entity.Icon= rune.Icon;
|
|
entity.Description = rune.Description;
|
|
entity.Family = rune.Family.ToString();
|
|
|
|
return entity;
|
|
}
|
|
|
|
public static EntitySkill SkillModeleToEntity(this Skill skill,int championId)
|
|
{
|
|
EntitySkill entity = new EntitySkill();
|
|
|
|
entity.Name = skill.Name;
|
|
entity.Description = skill.Description;
|
|
entity.Type = skill.Type.ToString();
|
|
entity.ChampionId = championId;
|
|
|
|
return entity;
|
|
}
|
|
|
|
|
|
}
|
|
}
|