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.
39 lines
1.1 KiB
39 lines
1.1 KiB
using EFlib;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EFMapping
|
|
{
|
|
public static class EFCharacteristicsMapper
|
|
{
|
|
public static EFCharacteristics toEF(this KeyValuePair<string, int> item, EFChampion champion, SQLiteContext context)
|
|
{
|
|
var EfCharacteristics = context.Characteristics.Find(item.Key, champion.Name);
|
|
if (EfCharacteristics == null)
|
|
{
|
|
return new()
|
|
{
|
|
Name = item.Key,
|
|
Value = item.Value,
|
|
NameChampion = champion.Name
|
|
};
|
|
}
|
|
return EfCharacteristics;
|
|
}
|
|
|
|
public static ReadOnlyDictionary<string, int> toModel(this EFCharacteristics charac)
|
|
{
|
|
var dict = new Dictionary<string, int>
|
|
{
|
|
{ charac.Name, charac.Value }
|
|
};
|
|
return new(dict);
|
|
}
|
|
}
|
|
}
|