This commit is contained in:
backuppc
2025-07-08 11:16:43 +09:00
parent d537030eb3
commit 8efe357430
11 changed files with 380 additions and 97 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Web.Http;
using System.Linq;
using VNCServerList.Models;
using VNCServerList.Services;
@@ -22,12 +23,21 @@ namespace VNCServerList.Web.Controllers
[HttpGet]
[Route("list")]
public IHttpActionResult GetServerList()
public IHttpActionResult GetServerList(string userName = null)
{
try
{
var servers = _databaseService.GetAllServers();
return Ok(servers);
// 사용자 이름이 있으면 필터링
if (!string.IsNullOrEmpty(userName))
{
servers = servers.Where(s => s.User.Equals(userName, StringComparison.OrdinalIgnoreCase)).ToList();
}
// 사용자명으로 오름차순 정렬
var sortedServers = servers.OrderBy(s => s.User).ThenBy(s => s.IP).ToList();
return Ok(sortedServers);
}
catch (Exception ex)
{