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.
59 lines
1.7 KiB
59 lines
1.7 KiB
using API.Dto;
|
|
using Model;
|
|
using System.Collections.ObjectModel;
|
|
|
|
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
|
|
{
|
|
Id = champion.Id,
|
|
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,
|
|
Keydic = champion.Characteristics.Keys,
|
|
Valuedic = champion.Characteristics.Values
|
|
};
|
|
}
|
|
public static ChampionDto ToDto(this Champion champion)
|
|
{
|
|
if (champion == null)
|
|
{
|
|
throw new ArgumentNullException("champion null");
|
|
}
|
|
|
|
return new ChampionDto
|
|
{
|
|
Id = champion.Id,
|
|
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,
|
|
Keydic = champion.Characteristics.Keys,
|
|
Valuedic = champion.Characteristics.Values
|
|
};
|
|
}
|
|
|
|
public static Champion ToSkin(this SkinDto skinDto)
|
|
{
|
|
if (skinDto == null)
|
|
{
|
|
throw new ArgumentNullException("Dto null");
|
|
}
|
|
|
|
return new SkinDto()
|
|
{
|
|
Name = skinDto.Name,
|
|
Description = skinDto.Description,
|
|
Icon = skinDto.Icon,
|
|
Price = skinDto.Price
|
|
}
|
|
}
|
|
}
|
|
}
|