Fix new scripts not being created

net8.0^2
Pat Hartl 2023-11-30 19:08:20 -06:00
parent 035c98cd18
commit 78168e94a5
2 changed files with 18 additions and 3 deletions

View File

@ -58,11 +58,18 @@
ICollection<Script> Scripts { get; set; } = new List<Script>();
protected override async Task OnParametersSetAsync()
{
await LoadData();
}
private async Task LoadData()
{
if (GameId != Guid.Empty)
Scripts = await ScriptService.Get(s => s.GameId == GameId).ToListAsync();
else if (RedistributableId != Guid.Empty)
Scripts = await ScriptService.Get(s => s.RedistributableId == RedistributableId).ToListAsync();
await InvokeAsync(StateHasChanged);
}
private async void Edit(Guid? scriptId = null)
@ -89,10 +96,8 @@
modalRef.OnOk = async (script) =>
{
await LoadData();
};
StateHasChanged();
}
private async void Delete(Script script = null)

View File

@ -85,6 +85,16 @@
{
if (Options.ScriptId != Guid.Empty)
Script = await ScriptService.Get(Options.ScriptId);
else if (Options.GameId != Guid.Empty)
Script = new Script()
{
GameId = Options.GameId
};
else if (Options.RedistributableId != Guid.Empty)
Script = new Script()
{
RedistributableId = Options.RedistributableId
};
Snippets = ScriptService.GetSnippets();
}