|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection.PortableExecutable;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using ApiDePaul.DTO;
|
|
|
|
|
using Model;
|
|
|
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
|
|
|
|
|
|
|
|
namespace ApiDePaul
|
|
|
|
|
{
|
|
|
|
@ -12,22 +14,45 @@ namespace ApiDePaul
|
|
|
|
|
{
|
|
|
|
|
public static ChampionDto ChampToDto(this Champion c)
|
|
|
|
|
{
|
|
|
|
|
return new ChampionDto()
|
|
|
|
|
ChampionDto champ = new ChampionDto();
|
|
|
|
|
champ.Name = c.Name;
|
|
|
|
|
champ.Bio = c.Bio;
|
|
|
|
|
champ.Icon = c.Icon;
|
|
|
|
|
champ.Characteristics = new List<Tuple<string, int>>();
|
|
|
|
|
foreach(var ch in c.Characteristics)
|
|
|
|
|
{
|
|
|
|
|
Name = c.Name,
|
|
|
|
|
Bio = c.Bio,
|
|
|
|
|
Icon = c.Icon,
|
|
|
|
|
Characteristics = c.Characteristics.ToDictionary(x => x.Key, x => x.Value)
|
|
|
|
|
};
|
|
|
|
|
champ.Characteristics.Add(new Tuple<string,int>(ch.Key, ch.Value));
|
|
|
|
|
}
|
|
|
|
|
//Characteristics = c.Characteristics.ToDictionary(x => x.Key, x => x.Value)
|
|
|
|
|
return champ;
|
|
|
|
|
}
|
|
|
|
|
public static Champion DtoToChamp(this ChampionDto c)
|
|
|
|
|
{
|
|
|
|
|
Champion champ = new Champion(c.Name);
|
|
|
|
|
string[] classes = { "Unknown", "Assassin", "Fighter", "Mage", "Marksman", "Support", "Tank" };
|
|
|
|
|
if (classes.ToList().Contains(c.Class))
|
|
|
|
|
{
|
|
|
|
|
champ.Class=(ChampionClass)Enum.Parse(typeof(ChampionClass), c.Class);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
champ.Class = 0;
|
|
|
|
|
}
|
|
|
|
|
champ.Icon = c.Icon;
|
|
|
|
|
champ.Image = new LargeImage(c.Image);
|
|
|
|
|
champ.Bio=c.Bio;
|
|
|
|
|
|
|
|
|
|
foreach(var s in c.Skills)
|
|
|
|
|
{
|
|
|
|
|
champ.AddSkill(s);
|
|
|
|
|
}
|
|
|
|
|
champ.AddCharacteristics(c.Characteristics.ToArray());
|
|
|
|
|
/*
|
|
|
|
|
//champ.Class = (ChampionClass)Enum.Parse(typeof(ChampionClass),c.Class);
|
|
|
|
|
champ.Icon = c.Icon;
|
|
|
|
|
//champ.Image = c.Image;
|
|
|
|
|
champ.Bio = c.Bio;
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
return champ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|