From 569cc5214629ef7d0f2dd953d795def8a5b23070 Mon Sep 17 00:00:00 2001 From: "nathan.boileau" Date: Wed, 15 Mar 2023 17:21:54 +0100 Subject: [PATCH] add: Info sur lien entre API et EF --- Sources/EFLol/EFDataManager.cs | 131 +++++++++++++++++++++++++++++++++ Sources/EFLol/EFLol.csproj | 5 ++ 2 files changed, 136 insertions(+) create mode 100644 Sources/EFLol/EFDataManager.cs diff --git a/Sources/EFLol/EFDataManager.cs b/Sources/EFLol/EFDataManager.cs new file mode 100644 index 0000000..66a7efc --- /dev/null +++ b/Sources/EFLol/EFDataManager.cs @@ -0,0 +1,131 @@ +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EFLol +{ + public class EFDataManager : IDataManager + { + // Connect to the MyDbContext class + private readonly MyDbContext _context; + + // Constructor + public EFDataManager(MyDbContext context) + { + _context = context; + } + + public IChampionsManager ChampionsMgr => throw new NotImplementedException(); + + public ISkinsManager SkinsMgr => throw new NotImplementedException(); + + public IRunesManager RunesMgr => throw new NotImplementedException(); + + public IRunePagesManager RunePagesMgr => throw new NotImplementedException(); + } + + public class EFChampionManager : IChampionsManager + { + private readonly MyDbContext _context; + + public EFChampionManager(MyDbContext context) + { + _context = context; + } + + public Task AddItem(Champion? item) + { + // Va chercher les info du context (Context.champions.get)(DbSet) et les map en champion model + // Dans Program.cs de API rajouter un scope (AddScope ) -> Ca va dire que a chaque fois que j'utilise un IDataManager, il va créer un EFDataManager + throw new NotImplementedException(); + } + + + public Task DeleteItem(Champion? item) + { + throw new NotImplementedException(); + } + public Task UpdateItem(Champion? oldItem, Champion? newItem) + { + throw new NotImplementedException(); + } + + public Task GetNbItems() + { + throw new NotImplementedException(); + } + + public Task> GetItems(int index, int count, string? orderingPropertyName = null, bool @descending = false) + { + throw new NotImplementedException(); + } + + public Task GetNbItemsByName(string substring) + { + throw new NotImplementedException(); + } + + public Task> GetItemsByName(string substring, int index, int count, string? orderingPropertyName = null, + bool @descending = false) + { + throw new NotImplementedException(); + } + + + public Task GetNbItemsByCharacteristic(string charName) + { + throw new NotImplementedException(); + } + + public Task> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, + bool @descending = false) + { + throw new NotImplementedException(); + } + + public Task GetNbItemsByClass(ChampionClass championClass) + { + throw new NotImplementedException(); + } + + public Task> GetItemsByClass(ChampionClass championClass, int index, int count, string? orderingPropertyName = null, + bool @descending = false) + { + throw new NotImplementedException(); + } + + public Task GetNbItemsBySkill(Skill? skill) + { + throw new NotImplementedException(); + } + + public Task> GetItemsBySkill(Skill? skill, int index, int count, string? orderingPropertyName = null, bool @descending = false) + { + throw new NotImplementedException(); + } + + public Task GetNbItemsByRunePage(RunePage? runePage) + { + throw new NotImplementedException(); + } + + public Task> GetItemsByRunePage(RunePage? runePage, int index, int count, string? orderingPropertyName = null, + bool @descending = false) + { + throw new NotImplementedException(); + } + + public Task GetNbItemsBySkill(string skill) + { + throw new NotImplementedException(); + } + + public Task> GetItemsBySkill(string skill, int index, int count, string? orderingPropertyName = null, bool @descending = false) + { + throw new NotImplementedException(); + } + } +} diff --git a/Sources/EFLol/EFLol.csproj b/Sources/EFLol/EFLol.csproj index bbc403a..17e021f 100644 --- a/Sources/EFLol/EFLol.csproj +++ b/Sources/EFLol/EFLol.csproj @@ -24,5 +24,10 @@ + + + + +