NBloodServerSupervisor/WebInterface/Controllers/HomeController.cs
2020-01-27 22:37:28 +00:00

29 lines
806 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using WebInterface.Services;
namespace WebInterface.Controllers
{
public class HomeController : Controller
{
IStateService _stateService;
public HomeController(IStateService stateService)
{
_stateService = stateService;
}
[Route("nblood/home", Name = "Home")]
public IActionResult Index()
{
var servers = _stateService.ListServers(HttpContext.Request.Host.Host).Servers;
var stats = _stateService.GetStatistics();
var viewModel = new HomeViewModel(servers, stats.RunningSinceUtc, stats.ManMinutesPlayed);
return View(viewModel);
}
}
}