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.
29 lines
809 B
29 lines
809 B
using Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Model;
|
|
|
|
namespace EntityMapper
|
|
{
|
|
public static class SkinMapper
|
|
{
|
|
public static SkinEntity ToEntity(this Skin item, LolDbContext? context = null)
|
|
{
|
|
return new()
|
|
{
|
|
Name = item.Name,
|
|
Champion = context?.champions.Find(item.Champion.Name) ?? item.Champion.ToEntity(context),
|
|
ChampionForeignKey = item.Champion.Name,
|
|
Description = item.Description,
|
|
Icon = item.Icon,
|
|
Image = null,
|
|
Price = item.Price
|
|
};
|
|
}
|
|
|
|
|
|
public static Skin ToModel(this SkinEntity entity)
|
|
=> new(entity.Name, entity.Champion.ToModel(), entity.Price, null, entity.Description);
|
|
|
|
}
|
|
}
|