diff --git a/.vs/LolProject2/v17/.wsuo b/.vs/LolProject2/v17/.wsuo new file mode 100644 index 0000000..a3c6a23 Binary files /dev/null and b/.vs/LolProject2/v17/.wsuo differ diff --git a/src/EntityFramework_LoL/Sources/ApiLol/Program.cs b/src/EntityFramework_LoL/Sources/ApiLol/Program.cs index 591bbb2..3f60ffd 100644 --- a/src/EntityFramework_LoL/Sources/ApiLol/Program.cs +++ b/src/EntityFramework_LoL/Sources/ApiLol/Program.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.Versioning; +using Microsoft.OpenApi.Models; using Model; var builder = WebApplication.CreateBuilder(args); @@ -9,7 +10,11 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); +builder.Services.AddSwaggerGen(options => +{ + 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