diff --git a/Portfolio.WebUI.Server/Components/Component/PokemonBackground.razor.cs b/Portfolio.WebUI.Server/Components/Component/PokemonBackground.razor.cs new file mode 100644 index 0000000..1529c8a --- /dev/null +++ b/Portfolio.WebUI.Server/Components/Component/PokemonBackground.razor.cs @@ -0,0 +1,6 @@ +namespace Portfolio.WebUI.Server.Components.Component +{ + public partial class PokemonBackground + { + } +} diff --git a/Portfolio.WebUI.Server/Components/Component/PokemonTable.razor.cs b/Portfolio.WebUI.Server/Components/Component/PokemonTable.razor.cs index e0f42c1..14f2d34 100644 --- a/Portfolio.WebUI.Server/Components/Component/PokemonTable.razor.cs +++ b/Portfolio.WebUI.Server/Components/Component/PokemonTable.razor.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.AspNetCore.Components; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.JSInterop; using Portfolio.Domain.Features.Pokemon; @@ -6,19 +7,18 @@ namespace Portfolio.WebUI.Server.Components.Component { public partial class PokemonTable { + [Parameter] + public List AllPokemon { get; set; } + private List pokemons = new List(); private Dictionary isShiny = new Dictionary(); - protected override async Task OnInitializedAsync() + protected override void OnParametersSet() { - var result = await PokemonService.GetAllPokemonAsync(); - if (result is not null) - { - pokemons = result; - pokemons.Sort((x, y) => x.PokemonId.CompareTo(y.PokemonId)); + if (AllPokemon != null) { + pokemons = AllPokemon.ToList(); - // Initialize dictionary with false (show base image first) foreach (var pokemon in pokemons) { isShiny[pokemon.Id] = false; diff --git a/Portfolio.WebUI.Server/Components/Pages/PokemonSleep.razor b/Portfolio.WebUI.Server/Components/Pages/PokemonSleep.razor index b70d3d1..fcfd6db 100644 --- a/Portfolio.WebUI.Server/Components/Pages/PokemonSleep.razor +++ b/Portfolio.WebUI.Server/Components/Pages/PokemonSleep.razor @@ -1,5 +1,7 @@ @page "/pokemonsleep" +@inject IPokemonService PokemonService + @attribute [StreamRendering] @rendermode InteractiveServer @@ -11,6 +13,6 @@ - + \ No newline at end of file diff --git a/Portfolio.WebUI.Server/Components/Pages/PokemonSleep.razor.cs b/Portfolio.WebUI.Server/Components/Pages/PokemonSleep.razor.cs new file mode 100644 index 0000000..be7a06c --- /dev/null +++ b/Portfolio.WebUI.Server/Components/Pages/PokemonSleep.razor.cs @@ -0,0 +1,23 @@ +using Portfolio.Application.Services.PokemonService; +using Portfolio.Domain.Features.Pokemon; + +namespace Portfolio.WebUI.Server.Components.Pages +{ + public partial class PokemonSleep + { + public List pokemons = new List(); + + + + protected override async Task OnInitializedAsync() + { + var result = await PokemonService.GetAllPokemonAsync(); + if (result is not null) + { + pokemons = result; + pokemons.Sort((x, y) => x.PokemonId.CompareTo(y.PokemonId)); + + } + } + } +}