Details-Page erstellt, allgemein FrontEnd aufgeräumt

This commit is contained in:
2025-06-28 23:24:58 +02:00
parent cfd1138339
commit dc93b87bff
8 changed files with 175 additions and 20 deletions

View File

@@ -1,4 +1,3 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@@ -116,13 +115,41 @@ public class ServerController : Controller
return View(vm);
}
// GET: Server/Details/5
[HttpGet]
public async Task<IActionResult> Details(int id)
{
var s = await _context.Servers.FindAsync(id);
if (s == null) return NotFound();
var vm = new ServerDetailsViewModel
{
Id = s.Id,
Name = s.Name,
IPAddress = s.IPAddress,
Type = s.Type,
Description = s.Description,
CpuType = s.CpuType,
CpuCores = s.CpuCores,
GpuType = s.GpuType,
RamSize = s.RamSize,
CreatedAt = s.CreatedAt,
IsOnline = s.IsOnline,
LastSeen = s.LastSeen,
IsVerified = s.IsVerified
};
return View(vm);
}
public async Task<IActionResult> ServerCardsPartial()
{
var servers = _context.Servers.ToList();
foreach (var server in servers)
{
server.IsOnline = (DateTime.UtcNow - server.LastSeen).TotalSeconds <= 120;
server.IsOnline = (DateTime.UtcNow - server.LastSeen).TotalSeconds <= 120;
await _context.SaveChangesAsync();
}