@using Microsoft.EntityFrameworkCore @inject GameService GameService @inject NavigationManager NavigationManager General @if (Id != Guid.Empty) { Media Archives Actions Multiplayer Save Paths Keys Scripts Custom Fields if (Game.DependentGames != null && Game.DependentGames.Any(g => g.Type == GameType.Expansion)) { Expansions } if (Game.DependentGames != null && Game.DependentGames.Any(g => g.Type == GameType.Mod)) { Mods } Play Sessions Saves } @if (TitleTemplate != null) { @TitleTemplate(Game) } else { @Title } @TitleExtraTemplate?.Invoke(Game)
@ChildContent?.Invoke(Game)
@code { [Parameter] public Guid Id { get; set; } [Parameter] public string Title { get; set; } [Parameter] public RenderFragment? TitleTemplate { get; set; } [Parameter] public RenderFragment? TitleExtraTemplate { get; set; } [Parameter] public RenderFragment? ChildContent { get; set; } Game Game { get; set; } = new Game(); Guid _id; protected override async Task OnParametersSetAsync() { if (_id != Id) { _id = Id; if (_id != Guid.Empty) Game = await GameService .Include(g => g.Actions) .Include(g => g.BaseGame) .Include(g => g.Categories) .Include(g => g.Collections) .Include(g => g.CreatedBy) .Include(g => g.DependentGames) .Include(g => g.Developers) .Include(g => g.Engine) .Include(g => g.Genres) .Include(g => g.Media) .Include(g => g.MultiplayerModes) .Include(g => g.Platforms) .Include(g => g.Publishers) .Include(g => g.Redistributables) .Include(g => g.SavePaths) .Include(g => g.Tags) .Include(g => g.UpdatedBy) .GetAsync(_id); else Game = new Game(); if (Game == null) NavigationManager.NavigateTo("/Games"); } } }