|
|
|
@ -22,74 +22,6 @@ namespace ProjetBlazor.Pages
|
|
|
|
|
[Inject]
|
|
|
|
|
public IDataService DataService { get; set; }
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
[Inject]
|
|
|
|
|
public NavigationManager NavigationManager { get; set; }
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
[Inject]
|
|
|
|
|
public IWebHostEnvironment WebHostEnvironment { get; set; }
|
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
|
|
|
|
var item = await DataService.GetById(Id);
|
|
|
|
|
|
|
|
|
|
var fileContent = await File.ReadAllBytesAsync($"{WebHostEnvironment.WebRootPath}/images/default.png");
|
|
|
|
|
|
|
|
|
|
if (File.Exists($"{WebHostEnvironment.WebRootPath}/images/{itemModel.Name}.png"))
|
|
|
|
|
{
|
|
|
|
|
fileContent = await File.ReadAllBytesAsync($"{WebHostEnvironment.WebRootPath}/images/{item.Name}.png");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the model with the item
|
|
|
|
|
itemModel = ItemFactory.ToModel(item, fileContent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void HandleValidSubmit()
|
|
|
|
|
{
|
|
|
|
|
await DataService.Update(Id, itemModel);
|
|
|
|
|
|
|
|
|
|
NavigationManager.NavigateTo("list");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnEnchantCategoriesChange(string item, object checkedValue)
|
|
|
|
|
{
|
|
|
|
|
if ((bool)checkedValue)
|
|
|
|
|
{
|
|
|
|
|
if (!itemModel.EnchantCategories.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
itemModel.EnchantCategories.Add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (itemModel.EnchantCategories.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
itemModel.EnchantCategories.Remove(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnRepairWithChange(string item, object checkedValue)
|
|
|
|
|
{
|
|
|
|
|
if ((bool)checkedValue)
|
|
|
|
|
{
|
|
|
|
|
if (!itemModel.RepairWith.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
itemModel.RepairWith.Add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (itemModel.RepairWith.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
itemModel.RepairWith.Remove(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
private async void HandleValidSubmit()
|
|
|
|
|
{
|
|
|
|
|