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.
42 lines
1.3 KiB
42 lines
1.3 KiB
using API.Dto;
|
|
using Model;
|
|
using System.Collections.ObjectModel;
|
|
using System.Reflection.PortableExecutable;
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
using System.Security.Claims;
|
|
|
|
namespace API.Mapping
|
|
{
|
|
public static class ChampionMapper
|
|
{
|
|
public static ChampionDto ToDto(this Champion champion)
|
|
{
|
|
if (champion == null)
|
|
{
|
|
throw new ArgumentNullException("champion null");
|
|
}
|
|
|
|
return new ChampionDto
|
|
{
|
|
Name = champion.Name, // je peux décider de mettre le nom en minuscule pour que le json est des noms en minuscule
|
|
Bio = champion.Bio,
|
|
Icon = champion.Icon,
|
|
Keydic = champion.Characteristics.Keys,
|
|
Valuedic = champion.Characteristics.Values,
|
|
Class = champion.Class,
|
|
Image = champion.Image,
|
|
Skins = champion.Skins
|
|
};
|
|
}
|
|
public static Champion ToModel(this ChampionDto champion)
|
|
{
|
|
if (champion == null)
|
|
{
|
|
throw new ArgumentNullException("championDto null");
|
|
}
|
|
|
|
return new Champion(champion.Name, champion.Class, champion.Icon, champion.Image.Base64, champion.Bio);
|
|
}
|
|
}
|
|
}
|