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.
LOLProject/Sources/APILOL/Mapper/RuneMapper.cs

42 lines
1.1 KiB

using DTO;
using EntityFrameworkLOL.Entities;
using Model;
namespace APILOL.Mapper
{
public static class RuneMapper
{
public static RuneDTO ToDto(this Rune rune)
{
return new RuneDTO()
{
Name = rune.Name,
Description = rune.Description,
Image = rune.Image.Base64,
Family = rune.Family,
};
}
public static Rune ToModel(this RuneDTO rune)
{
return new Rune(rune.Name, rune.Family, rune.Image, rune.Image, rune.Description);
}
public static Rune ToModel(this RuneEntity entity)
{
return new Rune(entity.Name, entity.Family, "", entity.Image.Base64, entity.Description);
}
public static RuneEntity ToEntity(this Rune item)
{
return new RuneEntity
{
Name = item.Name,
Description = item.Description,
Image = new() { Base64 = item.Image.Base64 },
Family = item.Family,
};
}
}
}