浏览代码

Optimized it, as Masu wished

Moritz 1 年之前
父节点
当前提交
d9dd9bbf4d
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      Moonlight/Core/UI/Views/Admin/Index.razor

+ 8 - 6
Moonlight/Core/UI/Views/Admin/Index.razor

@@ -18,7 +18,9 @@
                             <h6 class="text-uppercase text-muted mb-2">
                                 Users
                             </h6>
-                            <span class="h2 mb-0">@Users.Count</span>
+                            <span class="h2 mb-0">
+                                @UserCount
+                            </span>
                         </div>
                         <div class="col-auto">
                             <span class="h2 text-muted mb-0">
@@ -38,7 +40,7 @@
                                 Servers
                             </h6>
                             <span class="h2 mb-0">
-                                @Servers.Count
+                                @ServerCount
                             </span>
                         </div>
                         <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 *@
 
 @code {
-    private List<Server> Servers;
-    private List<User> Users;
+    private int ServerCount;
+    private int UserCount;
 
     private async Task Load(LazyLoader arg)
     {
         await Task.Run(() =>
         {
             arg.SetText("Loading Information...");
-            Servers = ServerRepository.Get().ToList();
-            Users = UserRepository.Get().ToList();
+            ServerCount = ServerRepository.Get().Count();
+            UserCount = UserRepository.Get().Count();
         });
     }
 }