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.
30 lines
896 B
30 lines
896 B
using EFlib;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EFMapping
|
|
{
|
|
public static class EFSkinMapper
|
|
{
|
|
public static EFSkin toEF(this Skin skin, SQLiteContext? context = null)
|
|
{
|
|
return new()
|
|
{
|
|
Name = skin.Name,
|
|
Description = skin.Description,
|
|
Icon = skin.Icon,
|
|
Price = skin.Price,
|
|
Image = new() { Id = Guid.NewGuid(), Base64 = skin.Image.Base64 },
|
|
NameChampion = skin.Champion.Name,
|
|
Champion = context?.Champions.Find(skin.Champion.Name) ?? skin.Champion.toEF(context),
|
|
};
|
|
}
|
|
|
|
public static Skin toModel(this EFSkin Skin)=> new(Skin.Name, Skin.Champion.toModel(), Skin.Price, null, Skin.Description);
|
|
}
|
|
}
|