weird error

master
Lilian BRETON 2 years ago
parent f0d89e4874
commit 8e96c6addd

@ -20,4 +20,3 @@
<InventoryItem Index="16" /> <InventoryItem Index="16" />
<InventoryItem Index="17" /> <InventoryItem Index="17" />
</div> </div>

@ -11,11 +11,6 @@
</div> </div>
<div id="ItemList"> <div id="ItemList">
<div>
<h3>List of Items</h3>
@*SearchBar*@
</div>
<div id="ItemList" class="align-end"> <div id="ItemList" class="align-end">
<div> <div>
@ -36,6 +31,7 @@
<DataGridColumn TItem="Item" Field=""/> <DataGridColumn TItem="Item" Field=""/>
<DataGridColumn TItem="Item" Field="@nameof(Item.DisplayName)" Caption="Display name" /> <DataGridColumn TItem="Item" Field="@nameof(Item.DisplayName)" Caption="Display name" />
<DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="Image"> <DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="Image">
<DisplayTemplate>
@if (!string.IsNullOrWhiteSpace(context.ImageBase64)) @if (!string.IsNullOrWhiteSpace(context.ImageBase64))
{ {
<img src="data:image/png;base64, @(context.ImageBase64)" class="img-thumbnail" title="@context.DisplayName" alt="@context.DisplayName" style="min-width: 50px; max-width: 150px" /> <img src="data:image/png;base64, @(context.ImageBase64)" class="img-thumbnail" title="@context.DisplayName" alt="@context.DisplayName" style="min-width: 50px; max-width: 150px" />
@ -44,6 +40,7 @@
{ {
<img src="images/default.png" class="img-thumbnail" title="@context.DisplayName" alt="@context.DisplayName" style="max-width: 150px"/> <img src="images/default.png" class="img-thumbnail" title="@context.DisplayName" alt="@context.DisplayName" style="max-width: 150px"/>
} }
</DisplayTemplate>
</DataGridColumn> </DataGridColumn>
</DataGrid> </DataGrid>
</div> </div>

@ -10,7 +10,8 @@ namespace myBlazorApp.Services
{ {
private readonly HttpClient _http; private readonly HttpClient _http;
public DataApiService(HttpClient http) public DataApiService(
HttpClient http)
{ {
_http = http; _http = http;
} }
@ -21,22 +22,22 @@ namespace myBlazorApp.Services
var item = ItemFactory.Create(model); var item = ItemFactory.Create(model);
// Save the data // Save the data
await _http.PostAsJsonAsync("https://localhost:8635/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://localhost:8635/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://localhost:8635/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://localhost:8635/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,17 +45,17 @@ namespace myBlazorApp.Services
// Get the item // Get the item
var item = ItemFactory.Create(model); var item = ItemFactory.Create(model);
await _http.PutAsJsonAsync($"https://localhost:8635/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://localhost:8635/api/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://localhost:8635/api/Crafting/recipe"); return await _http.GetFromJsonAsync<List<CraftingRecipe>>("https://localhost:7234/api/Crafting/recipe");
} }
} }
} }

Loading…
Cancel
Save