sort qui marche mais pas par 10

master
Mathilde JEAN 2 years ago
parent d432ccac13
commit 763503ab8d

@ -5,6 +5,8 @@ VisualStudioVersion = 17.2.32616.157
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp", "BlazorApp\BlazorApp.csproj", "{1E9341D6-EB75-4CD3-8144-A24BE53DB7E1}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp", "BlazorApp\BlazorApp.csproj", "{1E9341D6-EB75-4CD3-8144-A24BE53DB7E1}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Minecraft.Crafting.Api", "Minecraft.Crafting.Api\Minecraft.Crafting.Api.csproj", "{E1E95C86-6F7D-42A8-983F-C64395DB549C}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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}.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.ActiveCfg = Release|Any CPU
{1E9341D6-EB75-4CD3-8144-A24BE53DB7E1}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

@ -43,14 +43,16 @@
<div>Available items:</div> <div>Available items:</div>
<div> <div>
<Button type="submit" @onclick="() => SortByName()">SORT</Button>
<DataGrid TItem="Item" <DataGrid TItem="Item"
Data="@Items" Data="@Items"
ReadData="@OnReadData" ReadData="@OnReadData"
TotalItems="@totalItem" TotalItems="@totalItem"
PageSize="10" PageSize="10"
ShowPager ShowPager
Sortable="true"> Sortable="true">
<Button type="submit" @onclick="() => SortByName()">SORT</Button>
<DataGridColumn TItem="Item" Field="@nameof(Item.Id)"> <DataGridColumn TItem="Item" Field="@nameof(Item.Id)">
<DisplayTemplate> <DisplayTemplate>

@ -51,8 +51,7 @@ namespace BlazorApp.Components
private async Task SortByName() private async Task SortByName()
{ {
Items = (List<Item>)await DataService.SortedList(); Items = await DataService.SortedList();
StateHasChanged();
} }
void refresh() void refresh()

@ -21,22 +21,22 @@ namespace BlazorApp.Services
var item = ItemFactory.Create(model); var item = ItemFactory.Create(model);
// Save the data // 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<int> Count() public async Task<int> Count()
{ {
return await _http.GetFromJsonAsync<int>("https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/count"); return await _http.GetFromJsonAsync<int>("https://localhost:7234/api/Crafting/count");
} }
public async Task<List<Item>> List(int currentPage, int pageSize) public async Task<List<Item>> List(int currentPage, int pageSize)
{ {
return await _http.GetFromJsonAsync<List<Item>>($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/?currentPage={currentPage}&pageSize={pageSize}"); return await _http.GetFromJsonAsync<List<Item>>($"https://localhost:7234/api/Crafting/?currentPage={currentPage}&pageSize={pageSize}");
} }
public async Task<Item> GetById(int id) public async Task<Item> GetById(int id)
{ {
return await _http.GetFromJsonAsync<Item>($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/{id}"); return await _http.GetFromJsonAsync<Item>($"https://localhost:7234/api/Crafting/{id}");
} }
public async Task Update(int id, ItemModel model) public async Task Update(int id, ItemModel model)
@ -44,23 +44,23 @@ namespace BlazorApp.Services
// Get the item // Get the item
var item = ItemFactory.Create(model); 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) 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<List<CraftingRecipe>> GetRecipes() public async Task<List<CraftingRecipe>> GetRecipes()
{ {
return await _http.GetFromJsonAsync<List<CraftingRecipe>>("https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/recipe"); return await _http.GetFromJsonAsync<List<CraftingRecipe>>("https://localhost:7234/api/Crafting/recipe");
} }
public async Task<IEnumerable<Item>> SortedList() public async Task<List<Item>> SortedList()
{ {
List<Item> it = await _http.GetFromJsonAsync<List<Item>>($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-julienriboulet/api/Crafting/"); List<Item> it = await _http.GetFromJsonAsync<List<Item>>($"https://localhost:7234/api/Crafting/all/");
return it.OrderBy(i => i.Name); return it.OrderBy(i => i.DisplayName).ToList();
} }

@ -185,7 +185,7 @@ namespace BlazorApp.Services
return Task.FromResult(items); return Task.FromResult(items);
} }
public Task<IEnumerable<Item>> SortedList() public Task<List<Item>> SortedList()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

@ -14,7 +14,7 @@ namespace BlazorApp.Services
Task Update(int id, ItemModel itemModel); Task Update(int id, ItemModel itemModel);
Task Delete(int id); Task Delete(int id);
Task<List<CraftingRecipe>> GetRecipes(); Task<List<CraftingRecipe>> GetRecipes();
Task<IEnumerable<Item>> SortedList(); Task<List<Item>> SortedList();
} }
} }

@ -1,14 +1,22 @@
{ {
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51530",
"sslPort": 44598
}
},
"profiles": { "profiles": {
"Minecraft.Crafting.Api": { "Minecraft.Crafting.Api": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "swagger", "launchUrl": "swagger",
"applicationUrl": "https://localhost:7234;http://localhost:5234",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, }
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7234;http://localhost:5234"
}, },
"IIS Express": { "IIS Express": {
"commandName": "IISExpress", "commandName": "IISExpress",
@ -22,17 +30,7 @@
"commandName": "Docker", "commandName": "Docker",
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"publishAllPorts": true, "environmentVariables": {}
"useSSL": true
}
},
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51530",
"sslPort": 44598
} }
} }
} }
Loading…
Cancel
Save