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.
53 lines
1.4 KiB
53 lines
1.4 KiB
using DTO;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace RelationApi.Factories
|
|
{
|
|
public static class ChampionFacto {
|
|
public static Champion DtoToModel(this DtoChampions champDto)
|
|
{
|
|
ChampionClass classe = ChampionClass.Unknown;
|
|
switch (champDto.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;
|
|
}
|
|
return new Champion(champDto.name, champClass: classe, icon: champDto.icon, bio: champDto.bio, image: champDto.image);
|
|
}
|
|
|
|
public static DtoChampions ModelToDto(this Champion champ)
|
|
{
|
|
DtoChampions dto = new DtoChampions();
|
|
dto.name = champ.Name;
|
|
dto.classe = champ.Class.ToString();
|
|
dto.bio = champ.Bio;
|
|
dto.icon = champ.Icon;
|
|
dto.image = champ.Image.Base64;
|
|
|
|
return dto;
|
|
}
|
|
}
|
|
}
|