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 IGenericDataManager.AddItem(Champion? item) { if(item == null) { return null; } var additem = await context.AddAsync(item); await context.SaveChangesAsync(); return additem.Entity; } async Task IGenericDataManager.DeleteItem(Champion? item) { if(item == null) { return false; } context.Remove(item); await context.SaveChangesAsync(); return true; } async Task> IGenericDataManager.GetItems(int index, int count, string? orderingPropertyName, bool descending) { IEnumerable champions = context.Champions.Skip(index * count) .Take(count) .OrderBy(champions => orderingPropertyName) .Select(champions => champions.toModel()); return champions; } Task> IChampionsManager.GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName, bool descending) { throw new NotImplementedException(); } Task> IChampionsManager.GetItemsByClass(ChampionClass championClass, int index, int count, string? orderingPropertyName, bool descending) { throw new NotImplementedException(); } Task> IGenericDataManager.GetItemsByName(string substring, int index, int count, string? orderingPropertyName, bool descending) { throw new NotImplementedException(); } Task> IChampionsManager.GetItemsByRunePage(RunePage? runePage, int index, int count, string? orderingPropertyName, bool descending) { throw new NotImplementedException(); } Task> IChampionsManager.GetItemsBySkill(Skill? skill, int index, int count, string? orderingPropertyName, bool descending) { throw new NotImplementedException(); } Task> IChampionsManager.GetItemsBySkill(string skill, int index, int count, string? orderingPropertyName, bool descending) { throw new NotImplementedException(); } Task IGenericDataManager.GetNbItems() { throw new NotImplementedException(); } Task IChampionsManager.GetNbItemsByCharacteristic(string charName) { throw new NotImplementedException(); } Task IChampionsManager.GetNbItemsByClass(ChampionClass championClass) { throw new NotImplementedException(); } Task IGenericDataManager.GetNbItemsByName(string substring) { throw new NotImplementedException(); } Task IChampionsManager.GetNbItemsByRunePage(RunePage? runePage) { throw new NotImplementedException(); } Task IChampionsManager.GetNbItemsBySkill(Skill? skill) { throw new NotImplementedException(); } Task IChampionsManager.GetNbItemsBySkill(string skill) { throw new NotImplementedException(); } Task IGenericDataManager.UpdateItem(Champion? oldItem, Champion? newItem) { throw new NotImplementedException(); } } }