@page "/pokemonsleep/add-new-pokemon"
@inject IPokemonService PokemonService
@inject NavigationManager Navigation
}
@code {
private Pokemon NewPokemon = new Pokemon
{
PokemonId = 0, // Or any default ID logic
PokemonName = string.Empty, // Required fields cannot be null
SleepType = string.Empty,
Speciality = string.Empty,
IsVariation = false
};
private bool isSubmitting = false;
private bool ToggleVariationName { get; set; }
private void onDisable()
{
this.ToggleVariationName = true;
}
private async Task HandleSubmit()
{
isSubmitting = true;
await PokemonService.AddPokemonAsync(NewPokemon);
isSubmitting = false;
Navigation.NavigateTo("/pokemonsleep");
}
protected void Cancel(MouseEventArgs e)
{
Console.WriteLine("Testing in Cancel");
Navigation.NavigateTo("/pokemonsleep");
}
}