diff --git a/Sources/API_LoL/champion.db b/Sources/API_LoL/champion.db index cfdeed2..b651b93 100644 Binary files a/Sources/API_LoL/champion.db and b/Sources/API_LoL/champion.db differ diff --git a/Sources/API_LoL/champion.db-shm b/Sources/API_LoL/champion.db-shm index 39d4916..fe9ac28 100644 Binary files a/Sources/API_LoL/champion.db-shm and b/Sources/API_LoL/champion.db-shm differ diff --git a/Sources/API_LoL/champion.db-wal b/Sources/API_LoL/champion.db-wal index 932d20c..e69de29 100644 Binary files a/Sources/API_LoL/champion.db-wal and b/Sources/API_LoL/champion.db-wal differ diff --git a/Sources/HttpClient/HttpClientManager.Champion.cs b/Sources/HttpClient/HttpClientManager.Champion.cs index 9ffc79b..fa2eed6 100644 --- a/Sources/HttpClient/HttpClientManager.Champion.cs +++ b/Sources/HttpClient/HttpClientManager.Champion.cs @@ -1,4 +1,6 @@ -using Model; +using DTO; +using DTO.Mapper; +using Model; using System; using System.Collections.Generic; using System.Linq; @@ -34,20 +36,22 @@ namespace HttpClient public async Task AddItem(Champion? item) //return le champion ajouté, null sinon ? { if(item==null) throw new ArgumentNullException("item is null"); - var response = await httpc.PostAsJsonAsync("/Champion?Name = " + item.Name, item); + var response = await httpc.PostAsJsonAsync("v1/Champions?Name = " + item.Name, item); return response.IsSuccessStatusCode ? item : null; } public async Task DeleteItem(Champion? item) { - HttpResponseMessage response = await httpc.DeleteAsync("/Champion?Name=" + item.Name); + HttpResponseMessage response = await httpc.DeleteAsync("v1/Champions?Name=" + item.Name); return response.IsSuccessStatusCode; } - public Task> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false) + public async Task> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false) { - return httpc.GetFromJsonAsync>("/Champion?index="+index+"&size="+count); + + IEnumerable champdto = await httpc.GetFromJsonAsync>("v1/Champions?index="+index+"&size="+count); + return champdto.Select(c => c.ToChampion()); } diff --git a/Sources/HttpClient/HttpClientManager.cs b/Sources/HttpClient/HttpClientManager.cs index 49ddb70..f6947da 100644 --- a/Sources/HttpClient/HttpClientManager.cs +++ b/Sources/HttpClient/HttpClientManager.cs @@ -8,8 +8,6 @@ namespace HttpClient public System.Net.Http.HttpClient httpC { get; set; } = new System.Net.Http.HttpClient(); - public string BaseAddress; - public HttpClientManager() { ChampionsMgr = new ChampionManager(this, httpC); diff --git a/Sources/LeagueOfLegends.sln b/Sources/LeagueOfLegends.sln index 007e972..4ce78a2 100644 --- a/Sources/LeagueOfLegends.sln +++ b/Sources/LeagueOfLegends.sln @@ -26,7 +26,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Api_UT", "Api_UT\Api_UT.csp EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EF_UT", "EF_UT\EF_UT.csproj", "{74F469C3-A94A-4507-9DC7-7DBADCD18173}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HttpClient", "HttpClient\HttpClient.csproj", "{DE2E40D5-1B4D-491C-B7E7-4E91B32DB93F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HttpClient", "HttpClient\HttpClient.csproj", "{DE2E40D5-1B4D-491C-B7E7-4E91B32DB93F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{6570AF99-3E74-4CAA-AEB0-EEFE4F79780F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication", "ConsoleApplication\ConsoleApplication.csproj", "{53A195F7-FB7C-44E8-AB82-4D775C7D9477}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -70,6 +74,10 @@ Global {DE2E40D5-1B4D-491C-B7E7-4E91B32DB93F}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE2E40D5-1B4D-491C-B7E7-4E91B32DB93F}.Release|Any CPU.ActiveCfg = Release|Any CPU {DE2E40D5-1B4D-491C-B7E7-4E91B32DB93F}.Release|Any CPU.Build.0 = Release|Any CPU + {53A195F7-FB7C-44E8-AB82-4D775C7D9477}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {53A195F7-FB7C-44E8-AB82-4D775C7D9477}.Debug|Any CPU.Build.0 = Debug|Any CPU + {53A195F7-FB7C-44E8-AB82-4D775C7D9477}.Release|Any CPU.ActiveCfg = Release|Any CPU + {53A195F7-FB7C-44E8-AB82-4D775C7D9477}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -78,6 +86,7 @@ Global {B01D7EF2-2D64-409A-A29A-61FB7BB7A9DB} = {2C607793-B163-4731-A4D1-AFE8A7C4C170} {20A1A7DC-1E93-4506-BD32-8597A5DADD7B} = {C76D0C23-1FFA-4963-93CD-E12BD643F030} {74F469C3-A94A-4507-9DC7-7DBADCD18173} = {C76D0C23-1FFA-4963-93CD-E12BD643F030} + {53A195F7-FB7C-44E8-AB82-4D775C7D9477} = {6570AF99-3E74-4CAA-AEB0-EEFE4F79780F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {92F3083D-793F-4552-8A9A-0AD6534159C9}