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
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

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

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

@ -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<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)
{
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)
{
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)
@ -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<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/");
return it.OrderBy(i => i.Name);
List<Item> it = await _http.GetFromJsonAsync<List<Item>>($"https://localhost:7234/api/Crafting/all/");
return it.OrderBy(i => i.DisplayName).ToList();
}

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

@ -14,7 +14,7 @@ namespace BlazorApp.Services
Task Update(int id, ItemModel itemModel);
Task Delete(int id);
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": {
"Minecraft.Crafting.Api": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7234;http://localhost:5234",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7234;http://localhost:5234"
}
},
"IIS Express": {
"commandName": "IISExpress",
@ -22,17 +30,7 @@
"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
"environmentVariables": {}
}
}
}
Loading…
Cancel
Save