Add ability to delete games
This commit is contained in:
parent
42db70e3f5
commit
659cfda497
1 changed files with 19 additions and 1 deletions
|
@ -25,10 +25,15 @@
|
||||||
@context.UpdatedBy?.UserName
|
@context.UpdatedBy?.UserName
|
||||||
</PropertyColumn>
|
</PropertyColumn>
|
||||||
<ActionColumn Title="">
|
<ActionColumn Title="">
|
||||||
<Space>
|
<Space Direction="DirectionVHType.Horizontal">
|
||||||
<SpaceItem>
|
<SpaceItem>
|
||||||
<Button OnClick="() => Edit(context)">Edit</Button>
|
<Button OnClick="() => Edit(context)">Edit</Button>
|
||||||
</SpaceItem>
|
</SpaceItem>
|
||||||
|
<SpaceItem>
|
||||||
|
<Popconfirm OnConfirm="() => Delete(context)" Title="Are you sure you want to delete this game?">
|
||||||
|
<Button Icon="@IconType.Outline.Close" Type="@ButtonType.Text" Danger />
|
||||||
|
</Popconfirm>
|
||||||
|
</SpaceItem>
|
||||||
</Space>
|
</Space>
|
||||||
</ActionColumn>
|
</ActionColumn>
|
||||||
</Table>
|
</Table>
|
||||||
|
@ -64,4 +69,17 @@
|
||||||
{
|
{
|
||||||
NavigationManager.NavigateTo($"/Games/{game.Id}/Edit");
|
NavigationManager.NavigateTo($"/Games/{game.Id}/Edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task Delete(Game game)
|
||||||
|
{
|
||||||
|
Games = new List<Game>();
|
||||||
|
|
||||||
|
Loading = true;
|
||||||
|
|
||||||
|
await GameService.Delete(game);
|
||||||
|
|
||||||
|
Games = GameService.Get().OrderBy(g => String.IsNullOrWhiteSpace(g.SortTitle) ? g.Title : g.SortTitle).ToList();
|
||||||
|
|
||||||
|
Loading = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue