@page "/pokemonsleep/edit/{id:int}"
@inject IPokemonService PokemonService
@inject NavigationManager Navigation
@attribute [StreamRendering]
@rendermode InteractiveServer
Edit Pokémon
@if (pokemon == null)
{
Loading...
}
else
{
}
@code {
[Parameter] public int Id { get; set; }
private Pokemon? pokemon;
protected override async Task OnInitializedAsync()
{
pokemon = await PokemonService.GetPokemonByIdAsync(Id);
}
private async Task HandleSubmit()
{
await PokemonService.UpdatePokemonAsync(pokemon);
Navigation.NavigateTo("/pokemonsleep");
}
private void Cancel()
{
Navigation.NavigateTo("/pokemonsleep");
}
}