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.
64 lines
1.7 KiB
64 lines
1.7 KiB
using API.Dto;
|
|
using EFlib;
|
|
using Model;
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
using System.Collections.ObjectModel;
|
|
using System.Reflection.PortableExecutable;
|
|
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
|
|
{
|
|
//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,
|
|
};
|
|
}
|
|
|
|
/*public static Champion ToModel(this ChampionDto championDto)
|
|
{
|
|
if (championDto == null)
|
|
{
|
|
throw new ArgumentNullException("Dto null");
|
|
}
|
|
|
|
return new Champion
|
|
{
|
|
Name = championDto.Name,
|
|
Class = null,
|
|
Icon = null,
|
|
Image = null,
|
|
Bio = championDto.Bio,
|
|
Characteristics = null,
|
|
Skins = null,
|
|
};
|
|
}*/
|
|
|
|
public static EFChampion ToEF(this ChampionDto championDto)
|
|
{
|
|
if (championDto == null)
|
|
{
|
|
throw new ArgumentNullException("Dto null");
|
|
}
|
|
|
|
return new EFChampion
|
|
{
|
|
Id = championDto.Id,
|
|
Name = championDto.Name,
|
|
Bio = championDto.Bio,
|
|
Icon = null,
|
|
};
|
|
}
|
|
}
|
|
}
|