46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using Microsoft.AspNetCore.Components.Web;
|
|
using Portfolio.Domain.Features.Pokemon;
|
|
|
|
namespace Portfolio.WebUI.Server.Components.Pages
|
|
{
|
|
public partial class PokemonCreate
|
|
{
|
|
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");
|
|
}
|
|
|
|
}
|
|
}
|