2020-01-27 13:23:00 +01:00
|
|
|
|
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
|
|
|
|
|
{
|
2020-01-27 14:48:53 +01:00
|
|
|
|
IStateService _stateService;
|
2020-01-27 13:23:00 +01:00
|
|
|
|
|
2020-01-27 14:48:53 +01:00
|
|
|
|
public HomeController(IStateService stateService)
|
2020-01-27 13:23:00 +01:00
|
|
|
|
{
|
2020-01-27 14:48:53 +01:00
|
|
|
|
_stateService = stateService;
|
2020-01-27 13:23:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-01-27 23:37:28 +01:00
|
|
|
|
[Route("nblood/home", Name = "Home")]
|
2020-01-27 13:23:00 +01:00
|
|
|
|
public IActionResult Index()
|
|
|
|
|
{
|
2020-01-27 14:48:53 +01:00
|
|
|
|
var servers = _stateService.ListServers(HttpContext.Request.Host.Host).Servers;
|
|
|
|
|
var stats = _stateService.GetStatistics();
|
|
|
|
|
|
|
|
|
|
var viewModel = new HomeViewModel(servers, stats.RunningSinceUtc, stats.ManMinutesPlayed);
|
2020-01-27 13:23:00 +01:00
|
|
|
|
return View(viewModel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|