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.
35 lines
913 B
35 lines
913 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 EFSkillMapper
|
|
{
|
|
public static EFSkill toEF(this Skill skill, EFChampion champion, SQLiteContext context)
|
|
{
|
|
var EfSkill = context.Skills.Find(skill.Name);
|
|
if (EfSkill == null)
|
|
{
|
|
return new()
|
|
{
|
|
Name = skill.Name,
|
|
Description = skill.Description,
|
|
Type = skill.Type,
|
|
Champion = new List<EFChampion>() { champion }
|
|
};
|
|
}
|
|
EfSkill!.Champions?.Add(champion);
|
|
return EfSkill;
|
|
}
|
|
|
|
|
|
public static Skill toModel(this EFSkill skill)
|
|
=> new(skill.Name, skill.Type, skill.Description);
|
|
}
|
|
}
|