From 91c36e266c5f7758f35b31c53215e35e9a913e5a Mon Sep 17 00:00:00 2001 From: Emre Date: Sun, 26 Mar 2023 14:36:32 +0200 Subject: [PATCH] correct some errors :bug: --- .vs/LolProject2/v17/.wsuo | Bin 0 -> 11776 bytes .../Sources/ApiLol/Program.cs | 7 ++++- .../{Client.csproj => ApiManager.csproj} | 0 .../Sources/Client/ChampionHttpClient.cs | 27 +++++++++--------- .../Sources/Client/Program.cs | 4 ++- .../Sources/DbManager/DbManager.Runes.cs | 9 +++--- .../Sources/DbManager/Mapper/RuneMapper.cs | 2 +- .../Sources/LeagueOfLegends.sln | 2 +- 8 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 .vs/LolProject2/v17/.wsuo rename src/EntityFramework_LoL/Sources/Client/{Client.csproj => ApiManager.csproj} (100%) diff --git a/.vs/LolProject2/v17/.wsuo b/.vs/LolProject2/v17/.wsuo new file mode 100644 index 0000000000000000000000000000000000000000..a3c6a23b9c918ddb4773fdccbeab0281ee2123ba GIT binary patch literal 11776 zcmeHNUvC>l5MQShDE~_!K!FlMgert1JF$~Eh$;4tm~_O~7T|BXroQ1*A2_CE%?1N)caZ~IRA1Ns5l?n|iC zu4&I~bF28&?f)tCp{oa;@agYC9CSPs65zi26}9jBd-{LXrVa6YP;EYWE{veOg7PZL zYbd8sUPpNYMaOm59}0myVvEQj;@OrlNCma3Sd@P)L>?RHZO9nNeuK^PfcFu9PzRLQ zJWzVN7%L>4-X&2$^p^#-hC`b%7bDT8xFTkI#=1MkK%eoX@<;CXUTwxVjF$+D;64vp zq*ejtYdx#5@%;WG{%Z418TjGp{nUHaJ_niwNO}W5#+_?Y;zhBER#PDbJVztYXZ%JV zPguZy*Tk0C0o?|krg5)5nl?QYM8yd|6`7Q=l9sPl%terY_x{%; zr#qlYtzQHEswhDQ*AN@kAd?DuZ4300MFRZuT;_h7>K}36a}2<(f8?L^bGQfYKr`tb zg5cf0`R~^MEab2wHQ+{l72v6j+5H+`EDEy2EteuQ<@;UDRnsR``WVH)&Fm*=i2ea3dYGZJ*p zvf!ImV0)qo==`p<$r^U#W6-UkT^E;tL2b2n>_CZPY_=i&rBR1KV$q$k*goLZblfdBU1 zo6;Y}IJN&_=<}Rv!DI7Ou42`jm}fo${kJhr-T!k^+Z%E=Y8fe9Mqd$yJbs2fr$l%* zHrrkr6F4vn`aDk<>zVSe`@f+5Uk24Geq~7gg5i(KaVL$X~ zM;zaoqdt$OG4#8BV?sWNopt*l7<8+q*pFYn)*JIkwMWLnQm?&d8hVoxVSwtkU zE>_{wdD=BmXY9lJx{L*Q7v`C`E>B0shQwh^u-(pK+Bbzs^qWJ!`_Ft#+lDTo!3kMT zd#`N*_lhRY69bf0XQodQxUK8Ic)Jx`)5oxW5Ww6+7JFq!hB=(eyvMd=q^fRkLVSp? znLKqr=ve~qLG&Tx$*EZ@U9i&eVzE$)r&8r&yfB+7##5!~f|Z(1WlBj)N>*NXIZtJt zX@`Z0+{)bKP+JT+4;#8a7>GN!PmGi4R>X)B%n+Qv_W#7~;z z$FZKNaOml9=(FbN6izZEv&j(5%K4{5u4l#=pQi)$#veYv#mrN581KozG{q=#QM8vN z?jige1hnIRz@3BD+q|RbZPpJm|I7IYaJUi}GNBS%0IdJ@6b2S|4aGv+pZ~np7V+!H~m5WpE=LN%m2IOe+2En poqILazyF#2$NI5 +{ + options.SwaggerDoc("v1", new OpenApiInfo { Title = "My API v1", Version = "v1" }); + options.SwaggerDoc("v2", new OpenApiInfo { Title = "My API v2", Version = "v2" }); +}); builder.Services.AddApiVersioning(opt => diff --git a/src/EntityFramework_LoL/Sources/Client/Client.csproj b/src/EntityFramework_LoL/Sources/Client/ApiManager.csproj similarity index 100% rename from src/EntityFramework_LoL/Sources/Client/Client.csproj rename to src/EntityFramework_LoL/Sources/Client/ApiManager.csproj diff --git a/src/EntityFramework_LoL/Sources/Client/ChampionHttpClient.cs b/src/EntityFramework_LoL/Sources/Client/ChampionHttpClient.cs index 0ea6c35..c1e2f46 100644 --- a/src/EntityFramework_LoL/Sources/Client/ChampionHttpClient.cs +++ b/src/EntityFramework_LoL/Sources/Client/ChampionHttpClient.cs @@ -21,22 +21,23 @@ namespace Client public async Task> GetChampion(int index, int count) { var url = $"{UrlApiChampions}?index={index}&count={count}"; - return await _httpClient.GetFromJsonAsync>(url); + var Response = await _httpClient.GetFromJsonAsync>(url); + return Response.Data; } -/* public async void Add(ChampionDto champion) - { - await _httpClient.PostAsJsonAsync(ApiChampions, champion); - }*/ + /* public async void Add(ChampionDto champion) + { + await _httpClient.PostAsJsonAsync(ApiChampions, champion); + }*/ -/* public async void Delete(ChampionDto champion) - { - await _httpClient.DeleteAsync(champion.Name); - } + /* public async void Delete(ChampionDto champion) + { + await _httpClient.DeleteAsync(champion.Name); + } - public async void Update(ChampionDto champion) - { - await _httpClient.PutAsJsonAsync(ApiChampions, champion); - }*/ + public async void Update(ChampionDto champion) + { + await _httpClient.PutAsJsonAsync(ApiChampions, champion); + }*/ } } diff --git a/src/EntityFramework_LoL/Sources/Client/Program.cs b/src/EntityFramework_LoL/Sources/Client/Program.cs index e0dab23..70ce525 100644 --- a/src/EntityFramework_LoL/Sources/Client/Program.cs +++ b/src/EntityFramework_LoL/Sources/Client/Program.cs @@ -34,4 +34,6 @@ if (championToUpdate != null) Console.WriteLine($"{championToUpdate.Name} updated."); } -*/ \ No newline at end of file +*/ + +Console.ReadLine(); \ No newline at end of file diff --git a/src/EntityFramework_LoL/Sources/DbManager/DbManager.Runes.cs b/src/EntityFramework_LoL/Sources/DbManager/DbManager.Runes.cs index a40a901..b8f6a1f 100644 --- a/src/EntityFramework_LoL/Sources/DbManager/DbManager.Runes.cs +++ b/src/EntityFramework_LoL/Sources/DbManager/DbManager.Runes.cs @@ -1,4 +1,5 @@ using DbManager.Mapper; +using Microsoft.EntityFrameworkCore; using Model; namespace DbLib @@ -40,22 +41,22 @@ namespace DbLib = (rune, substring) => rune.Name.Contains(substring, StringComparison.InvariantCultureIgnoreCase); public async Task> GetItemByName(string substring, int index, int count, string? orderingPropertyName = null, bool descending = false) - => parent.DbContext.Runes.GetItemsWithFilterAndOrdering( + => parent.DbContext.Runes.Include(r => r.Image).GetItemsWithFilterAndOrdering( rune => filterByName(rune.ToModel(), substring), index, count, orderingPropertyName, descending).Select(c => c.ToModel()); public async Task> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false) - => parent.DbContext.Runes.GetItemsWithFilterAndOrdering( + => parent.DbContext.Runes.Include(r => r.Image).GetItemsWithFilterAndOrdering( r => true, index, count, orderingPropertyName, descending).Select(c => c.ToModel()); public async Task> GetItemsByFamily(RuneFamily family, int index, int count, string? orderingPropertyName = null, bool descending = false) - => parent.DbContext.Runes.GetItemsWithFilterAndOrdering( + => parent.DbContext.Runes.Include(r => r.Image).GetItemsWithFilterAndOrdering( rune => filterByRuneFamily(rune.ToModel(), family), index, count, orderingPropertyName, descending).Select(c => c.ToModel()); public async Task> GetItemsByName(string substring, int index, int count, string? orderingPropertyName = null, bool descending = false) - => parent.DbContext.Runes.GetItemsWithFilterAndOrdering( + => parent.DbContext.Runes.Include(r => r.Image).GetItemsWithFilterAndOrdering( rune => filterByNameContains(rune.ToModel(), substring), index, count, orderingPropertyName, descending).Select(c => c.ToModel()); diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/RuneMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/RuneMapper.cs index 744c73f..788ce1e 100644 --- a/src/EntityFramework_LoL/Sources/DbManager/Mapper/RuneMapper.cs +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/RuneMapper.cs @@ -6,7 +6,7 @@ namespace DbManager.Mapper { public static class RuneMapper { - public static Rune ToModel(this RuneEntity rune) => new(rune.Name, rune.Family.ToModel(), rune.Icon, "", rune.Description); + public static Rune ToModel(this RuneEntity rune) => new(rune.Name, rune.Family.ToModel(), rune.Icon, rune.Image.Base64, rune.Description); public static RuneEntity ToEntity(this Rune rune) => new() { diff --git a/src/EntityFramework_LoL/Sources/LeagueOfLegends.sln b/src/EntityFramework_LoL/Sources/LeagueOfLegends.sln index 4256fc6..339d0ce 100644 --- a/src/EntityFramework_LoL/Sources/LeagueOfLegends.sln +++ b/src/EntityFramework_LoL/Sources/LeagueOfLegends.sln @@ -21,7 +21,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DTO", "DTO\DTO.csproj", "{3 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiTests", "Tests\ApiTests\ApiTests.csproj", "{1779D8A4-2E12-47F3-BDA2-2E7F04B758EB}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "Client\Client.csproj", "{464DAB04-BE65-429D-9A39-3E1BB43C521A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiManager", "Client\ApiManager.csproj", "{464DAB04-BE65-429D-9A39-3E1BB43C521A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyFlib", "MyFlib\MyFlib.csproj", "{2142AB69-B483-4B0A-96DC-CFA87DEB11A5}" EndProject