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.

37 lines
945 B

using API.Dto;
using Model;
namespace API.Mapping
{
public static class SkinMapper
{
public static SkinDto ToDto(this Skin skin)
{
if (skin == null)
{
throw new ArgumentNullException("Skin null");
}
return new SkinDto()
{
Name = skin.Name,
Champion = skin.Champion.ToDto(),
Description = skin.Description,
Price = skin.Price,
Icon = skin.Icon,
Image = skin.Image
};
}
public static Skin ToModel(this SkinDto skinDto)
{
if (skinDto == null)
{
throw new ArgumentNullException("DtoSkin null");
}
return new Skin(skinDto.Name, skinDto.Champion.ToModel(), skinDto.Price, skinDto.Icon, skinDto.Image.Base64, skinDto.Description);
}
}
}