From 4655e75da5cedaaeb3c702bd3782635b07c59860 Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Sat, 11 Feb 2023 21:39:57 -0600 Subject: [PATCH] Added keys count to edit view --- LANCommander/Pages/Games/Edit.razor | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/LANCommander/Pages/Games/Edit.razor b/LANCommander/Pages/Games/Edit.razor index dbc43da..3f5364b 100644 --- a/LANCommander/Pages/Games/Edit.razor +++ b/LANCommander/Pages/Games/Edit.razor @@ -85,6 +85,38 @@ + + + + + Keys + + + + View + + + + + + + Available + @KeysAvailable + + + + Claimed + @(Game.Keys.Count - KeysAvailable) + + + + Total + @Game.Keys.Count + + + + + @code { @@ -96,6 +128,15 @@ private Game Game { get; set; } + private int KeysAvailable { get { + return Game.Keys.Count(k => + { + return (k.AllocationMethod == KeyAllocationMethod.MacAddress && String.IsNullOrWhiteSpace(k.ClaimedByMacAddress)) + || + (k.AllocationMethod == KeyAllocationMethod.UserAccount && k.ClaimedByUser == null); + }); + } } + protected override async Task OnInitializedAsync() { Game = await GameService.Get(Id);