From 763503ab8d5b2669815fa5cb3b8096c4145cf433 Mon Sep 17 00:00:00 2001 From: majean5 Date: Fri, 16 Dec 2022 10:35:51 +0100 Subject: [PATCH] sort qui marche mais pas par 10 --- BlazorApp/BlazorApp.sln | 6 ++ .../BlazorApp/Components/InventoryComp.razor | 6 +- .../Components/InventoryComp.razor.cs | 3 +- .../BlazorApp/Services/DataApiService.cs | 20 +++--- .../BlazorApp/Services/DataLocalService.cs | 2 +- BlazorApp/BlazorApp/Services/IDataService.cs | 2 +- .../Properties/launchSettings.json | 72 +++++++++---------- 7 files changed, 58 insertions(+), 53 deletions(-) diff --git a/BlazorApp/BlazorApp.sln b/BlazorApp/BlazorApp.sln index 3b49dd0..80c6881 100644 --- a/BlazorApp/BlazorApp.sln +++ b/BlazorApp/BlazorApp.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.2.32616.157 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp", "BlazorApp\BlazorApp.csproj", "{1E9341D6-EB75-4CD3-8144-A24BE53DB7E1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Minecraft.Crafting.Api", "Minecraft.Crafting.Api\Minecraft.Crafting.Api.csproj", "{E1E95C86-6F7D-42A8-983F-C64395DB549C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {1E9341D6-EB75-4CD3-8144-A24BE53DB7E1}.Debug|Any CPU.Build.0 = Debug|Any CPU {1E9341D6-EB75-4CD3-8144-A24BE53DB7E1}.Release|Any CPU.ActiveCfg = Release|Any CPU {1E9341D6-EB75-4CD3-8144-A24BE53DB7E1}.Release|Any CPU.Build.0 = Release|Any CPU + {E1E95C86-6F7D-42A8-983F-C64395DB549C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1E95C86-6F7D-42A8-983F-C64395DB549C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1E95C86-6F7D-42A8-983F-C64395DB549C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1E95C86-6F7D-42A8-983F-C64395DB549C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BlazorApp/BlazorApp/Components/InventoryComp.razor b/BlazorApp/BlazorApp/Components/InventoryComp.razor index 4cecf82..ab7078a 100644 --- a/BlazorApp/BlazorApp/Components/InventoryComp.razor +++ b/BlazorApp/BlazorApp/Components/InventoryComp.razor @@ -43,15 +43,17 @@
Available items:
- + - + + @if (!string.IsNullOrWhiteSpace(context.ImageBase64)) diff --git a/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs b/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs index 68055b1..6ca14eb 100644 --- a/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs +++ b/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs @@ -51,8 +51,7 @@ namespace BlazorApp.Components private async Task SortByName() { - Items = (List)await DataService.SortedList(); - StateHasChanged(); + Items = await DataService.SortedList(); } void refresh() diff --git a/BlazorApp/BlazorApp/Services/DataApiService.cs b/BlazorApp/BlazorApp/Services/DataApiService.cs index 288a90d..035adb2 100644 --- a/BlazorApp/BlazorApp/Services/DataApiService.cs +++ b/BlazorApp/BlazorApp/Services/DataApiService.cs @@ -21,22 +21,22 @@ namespace BlazorApp.Services var item = ItemFactory.Create(model); // Save the data - await _http.PostAsJsonAsync("https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/", item); + await _http.PostAsJsonAsync("https://localhost:7234/api/Crafting/", item); } public async Task Count() { - return await _http.GetFromJsonAsync("https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/count"); + return await _http.GetFromJsonAsync("https://localhost:7234/api/Crafting/count"); } public async Task> List(int currentPage, int pageSize) { - return await _http.GetFromJsonAsync>($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/?currentPage={currentPage}&pageSize={pageSize}"); + return await _http.GetFromJsonAsync>($"https://localhost:7234/api/Crafting/?currentPage={currentPage}&pageSize={pageSize}"); } public async Task GetById(int id) { - return await _http.GetFromJsonAsync($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/{id}"); + return await _http.GetFromJsonAsync($"https://localhost:7234/api/Crafting/{id}"); } public async Task Update(int id, ItemModel model) @@ -44,23 +44,23 @@ namespace BlazorApp.Services // Get the item var item = ItemFactory.Create(model); - await _http.PutAsJsonAsync($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/{id}", item); + await _http.PutAsJsonAsync($"https://localhost:7234/api/Crafting/{id}", item); } public async Task Delete(int id) { - await _http.DeleteAsync($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/Crafting/{id}"); + await _http.DeleteAsync($"https://localhost:7234/api/Crafting/{id}"); } public async Task> GetRecipes() { - return await _http.GetFromJsonAsync>("https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/recipe"); + return await _http.GetFromJsonAsync>("https://localhost:7234/api/Crafting/recipe"); } - public async Task> SortedList() + public async Task> SortedList() { - List it = await _http.GetFromJsonAsync>($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/"); - return it.OrderBy(i => i.Name); + List it = await _http.GetFromJsonAsync>($"https://localhost:7234/api/Crafting/all/"); + return it.OrderBy(i => i.DisplayName).ToList(); } diff --git a/BlazorApp/BlazorApp/Services/DataLocalService.cs b/BlazorApp/BlazorApp/Services/DataLocalService.cs index 912dc11..3b13a80 100644 --- a/BlazorApp/BlazorApp/Services/DataLocalService.cs +++ b/BlazorApp/BlazorApp/Services/DataLocalService.cs @@ -185,7 +185,7 @@ namespace BlazorApp.Services return Task.FromResult(items); } - public Task> SortedList() + public Task> SortedList() { throw new NotImplementedException(); } diff --git a/BlazorApp/BlazorApp/Services/IDataService.cs b/BlazorApp/BlazorApp/Services/IDataService.cs index b85b236..a39928c 100644 --- a/BlazorApp/BlazorApp/Services/IDataService.cs +++ b/BlazorApp/BlazorApp/Services/IDataService.cs @@ -14,7 +14,7 @@ namespace BlazorApp.Services Task Update(int id, ItemModel itemModel); Task Delete(int id); Task> GetRecipes(); - Task> SortedList(); + Task> SortedList(); } } diff --git a/BlazorApp/Minecraft.Crafting.Api/Properties/launchSettings.json b/BlazorApp/Minecraft.Crafting.Api/Properties/launchSettings.json index 0a638af..a72705a 100644 --- a/BlazorApp/Minecraft.Crafting.Api/Properties/launchSettings.json +++ b/BlazorApp/Minecraft.Crafting.Api/Properties/launchSettings.json @@ -1,38 +1,36 @@ -{ - "profiles": { - "Minecraft.Crafting.Api": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "dotnetRunMessages": true, - "applicationUrl": "https://localhost:7234;http://localhost:5234" - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Docker": { - "commandName": "Docker", - "launchBrowser": true, - "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", - "publishAllPorts": true, - "useSSL": true - } - }, - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:51530", - "sslPort": 44598 - } - } +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:51530", + "sslPort": 44598 + } + }, + "profiles": { + "Minecraft.Crafting.Api": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7234;http://localhost:5234", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "environmentVariables": {} + } + } } \ No newline at end of file