NBloodServerSupervisor/WebInterface/Controllers/HomeController.cs
2020-01-27 13:48:53 +00:00

29 lines
791 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")]
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);
}
}
}