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.
127 lines
4.2 KiB
127 lines
4.2 KiB
using EntityFrameworkLib.Mappers;
|
|
using Model;
|
|
using Shared;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EntityFrameworkLib
|
|
{
|
|
public class DBChampionManager : IChampionsManager
|
|
{
|
|
private readonly LolContext context;
|
|
|
|
public DBChampionManager()
|
|
{
|
|
}
|
|
|
|
public DBChampionManager(LolContext context)
|
|
{
|
|
this.context = context;
|
|
}
|
|
|
|
async Task<Champion?> IGenericDataManager<Champion?>.AddItem(Champion? item)
|
|
{
|
|
if(item == null)
|
|
{
|
|
return null;
|
|
}
|
|
var additem = await context.AddAsync<Champion?>(item);
|
|
await context.SaveChangesAsync();
|
|
return additem.Entity;
|
|
}
|
|
|
|
async Task<bool> IGenericDataManager<Champion?>.DeleteItem(Champion? item)
|
|
{
|
|
if(item == null)
|
|
{
|
|
return false;
|
|
}
|
|
context.Remove<Champion>(item);
|
|
await context.SaveChangesAsync();
|
|
return true;
|
|
}
|
|
|
|
async Task<IEnumerable<Champion?>> IGenericDataManager<Champion?>.GetItems(int index, int count, string? orderingPropertyName, bool descending)
|
|
{
|
|
IEnumerable<Champion> champions = context.Champions.Skip(index * count)
|
|
.Take(count)
|
|
.OrderBy(champions => orderingPropertyName)
|
|
.Select(champions => champions.toModel());
|
|
return champions;
|
|
}
|
|
|
|
Task<IEnumerable<Champion?>> IChampionsManager.GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName, bool descending)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<IEnumerable<Champion?>> IChampionsManager.GetItemsByClass(ChampionClass championClass, int index, int count, string? orderingPropertyName, bool descending)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<IEnumerable<Champion?>> IGenericDataManager<Champion?>.GetItemsByName(string substring, int index, int count, string? orderingPropertyName, bool descending)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<IEnumerable<Champion?>> IChampionsManager.GetItemsByRunePage(RunePage? runePage, int index, int count, string? orderingPropertyName, bool descending)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<IEnumerable<Champion?>> IChampionsManager.GetItemsBySkill(Skill? skill, int index, int count, string? orderingPropertyName, bool descending)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<IEnumerable<Champion?>> IChampionsManager.GetItemsBySkill(string skill, int index, int count, string? orderingPropertyName, bool descending)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<int> IGenericDataManager<Champion?>.GetNbItems()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<int> IChampionsManager.GetNbItemsByCharacteristic(string charName)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<int> IChampionsManager.GetNbItemsByClass(ChampionClass championClass)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<int> IGenericDataManager<Champion?>.GetNbItemsByName(string substring)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<int> IChampionsManager.GetNbItemsByRunePage(RunePage? runePage)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<int> IChampionsManager.GetNbItemsBySkill(Skill? skill)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<int> IChampionsManager.GetNbItemsBySkill(string skill)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
Task<Champion?> IGenericDataManager<Champion?>.UpdateItem(Champion? oldItem, Champion? newItem)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|