Details-Page erstellt, allgemein FrontEnd aufgeräumt
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user