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.
33 lines
777 B
33 lines
777 B
using Entities;
|
|
using Model;
|
|
using System.Reflection.Metadata.Ecma335;
|
|
|
|
namespace EntityMapper
|
|
{
|
|
public static class RuneMapper
|
|
{
|
|
public static RuneEntity ToEntity(this Rune item, LolDbContext context)
|
|
{
|
|
RuneEntity runeEntity = context.runes.Find(item.Name);
|
|
if (runeEntity == null) {
|
|
return new()
|
|
{
|
|
Name = item.Name,
|
|
Description = item.Description,
|
|
RuneFamily = item.Family
|
|
};
|
|
}
|
|
return runeEntity;
|
|
}
|
|
|
|
|
|
public static Rune ToModel(this RuneEntity entity)
|
|
{
|
|
return new Rune(entity.Name, entity.RuneFamily, "", "", entity.Description);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|