Add GetCities function to ServersRepository class.
This commit is contained in:
parent
2151da4ef5
commit
64d4389c9a
@ -76,5 +76,15 @@ namespace ServerManagement.Models
|
||||
{
|
||||
return servers.Where(s => s.Name.Contains(serverFilter, StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
}
|
||||
|
||||
public static List<string> GetCities()
|
||||
{
|
||||
return servers
|
||||
.Select(s => s.City)
|
||||
.Where(city => !string.IsNullOrEmpty(city))
|
||||
.Select(city => city!) // Null-forgiving operator
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user