mirror of
https://github.com/ryzij/ServerMonitor.git
synced 2026-09-18 19:23:22 +00:00
Небольшое изменение
This commit is contained in:
@@ -3,10 +3,10 @@ namespace MonitorPanel.Core.Models;
|
|||||||
public class Server(
|
public class Server(
|
||||||
Guid id,
|
Guid id,
|
||||||
string name,
|
string name,
|
||||||
bool isHttps,
|
|
||||||
string address,
|
string address,
|
||||||
string? path,
|
string? path = null,
|
||||||
int port)
|
bool isHttps = true,
|
||||||
|
int port = 443)
|
||||||
{
|
{
|
||||||
public readonly Guid Id = id;
|
public readonly Guid Id = id;
|
||||||
public string Name { get; set; } = name;
|
public string Name { get; set; } = name;
|
||||||
|
|||||||
@@ -33,14 +33,14 @@ public class ServersRepository(MonitorPanelDbContext db) : IServersRepository
|
|||||||
public async Task<IEnumerable<Server>> GetAllServersAsync()
|
public async Task<IEnumerable<Server>> GetAllServersAsync()
|
||||||
{
|
{
|
||||||
return await db.Servers.AsNoTracking()
|
return await db.Servers.AsNoTracking()
|
||||||
.Select(s => new Server(s.Id, s.Name, s.IsHttps, s.Address, s.Path, s.Port))
|
.Select(s => new Server(s.Id, s.Name, s.Address, s.Path, s.IsHttps, s.Port))
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Server?> GetServerByIdAsync(Guid id)
|
public async Task<Server?> GetServerByIdAsync(Guid id)
|
||||||
{
|
{
|
||||||
var entity = await db.Servers.FirstOrDefaultAsync(s => s.Id == id);
|
var entity = await db.Servers.FirstOrDefaultAsync(s => s.Id == id);
|
||||||
return entity == null ? null : new Server(entity.Id, entity.Name, entity.IsHttps, entity.Address, entity.Path, entity.Port);
|
return entity == null ? null : new Server(entity.Id, entity.Name, entity.Address, entity.Path, entity.IsHttps, entity.Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Guid> UpdateServerAsync(Guid id, string name, bool isHttps, string address, string? path, int port)
|
public async Task<Guid> UpdateServerAsync(Guid id, string name, bool isHttps, string address, string? path, int port)
|
||||||
|
|||||||
Reference in New Issue
Block a user