28 lines
697 B
C#
28 lines
697 B
C#
using Microsoft.AspNetCore.Components;
|
|
using Portfolio.Domain.Features.Pokemon;
|
|
|
|
namespace Portfolio.WebUI.Server.Components.Pages
|
|
{
|
|
public partial class PokemonEdit
|
|
{
|
|
[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");
|
|
}
|
|
}
|
|
}
|