@inject GameService GameService @if (context.Type == SavePathType.Registry) { } else { }
@code { [Parameter] public Guid GameId { get; set; } [Parameter] public Guid ArchiveId { get; set; } ICollection SavePaths = new List(); protected override async Task OnInitializedAsync() { var game = await GameService.Include(g => g.SavePaths).GetAsync(GameId); if (game.SavePaths != null) SavePaths = game.SavePaths; } async Task AddPath() { SavePaths.Add(new SavePath() { GameId = GameId, WorkingDirectory = "{InstallDir}" }); } async Task RemovePath(SavePath path) { SavePaths.Remove(path); } public async Task Save() { var game = await GameService.Include(g => g.SavePaths).GetAsync(GameId); game.SavePaths = SavePaths; await GameService.UpdateAsync(game); } }