diff --git a/LANCommander/Pages/Games/Index.razor b/LANCommander/Pages/Games/Index.razor index f55e500..0568e00 100644 --- a/LANCommander/Pages/Games/Index.razor +++ b/LANCommander/Pages/Games/Index.razor @@ -1,4 +1,5 @@ @page "/Games" +@using AntDesign.TableModels; @using LANCommander.Extensions; @using System.ComponentModel.DataAnnotations; @using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; @@ -9,7 +10,14 @@ - + + + + + + + + @@ -35,7 +43,7 @@ - +
@if (FieldVisible(Field.Icon)) { @@ -192,6 +200,10 @@ bool Loading = true; bool FieldPickerVisible = false; + string Search = ""; + + ITable Table; + Dictionary FieldVisibility = new Dictionary() { { Field.Icon, true }, @@ -239,7 +251,7 @@ { if (firstRender) { - Games = GameService.Get().OrderBy(g => String.IsNullOrWhiteSpace(g.SortTitle) ? g.Title : g.SortTitle).ToList(); + LoadData(); Loading = false; @@ -252,6 +264,11 @@ } } + private void LoadData() + { + Games = GameService.Get(g => g.Title.ToLower().Contains(Search.ToLower().Trim()) || g.SortTitle.ToLower().Contains(Search.ToLower().Trim())).OrderBy(g => String.IsNullOrWhiteSpace(g.SortTitle) ? g.Title : g.SortTitle).ToList(); + } + private bool FieldVisible(Field field) { return FieldVisibility.ContainsKey(field) && FieldVisibility[field] == true;