@page "/pokemonsleep/add-new-pokemon" @inject IPokemonService PokemonService @inject NavigationManager Navigation @attribute [StreamRendering] @rendermode InteractiveServer Add New Pokémon

Pokémon Sleep

@if (isSubmitting) {

Submitting...

} else {

Add New Pokémon

#
Variation?
} @code { private bool HideLabel { get; set; } = true; private void Toggle() { HideLabel = !HideLabel; } 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"); } }