Optimized it, as Masu wished

This commit is contained in:
Moritz 2024-05-14 00:42:00 +02:00
parent 160de6443b
commit d9dd9bbf4d

View file

@ -18,7 +18,9 @@
<h6 class="text-uppercase text-muted mb-2"> <h6 class="text-uppercase text-muted mb-2">
Users Users
</h6> </h6>
<span class="h2 mb-0">@Users.Count</span> <span class="h2 mb-0">
@UserCount
</span>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<span class="h2 text-muted mb-0"> <span class="h2 text-muted mb-0">
@ -38,7 +40,7 @@
Servers Servers
</h6> </h6>
<span class="h2 mb-0"> <span class="h2 mb-0">
@Servers.Count @ServerCount
</span> </span>
</div> </div>
<div class="col-auto"> <div class="col-auto">
@ -56,16 +58,16 @@
@* This is just the start of this admin page, there will still be added more during the developement process *@ @* This is just the start of this admin page, there will still be added more during the developement process *@
@code { @code {
private List<Server> Servers; private int ServerCount;
private List<User> Users; private int UserCount;
private async Task Load(LazyLoader arg) private async Task Load(LazyLoader arg)
{ {
await Task.Run(() => await Task.Run(() =>
{ {
arg.SetText("Loading Information..."); arg.SetText("Loading Information...");
Servers = ServerRepository.Get().ToList(); ServerCount = ServerRepository.Get().Count();
Users = UserRepository.Get().ToList(); UserCount = UserRepository.Get().Count();
}); });
} }
} }