NBloodServerSupervisor/WebInterface/Controllers/HomeController.cs

29 lines
806 B
C#
Raw Normal View History

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 14:48:53 +01:00
public HomeController(IStateService stateService)
{
2020-01-27 14:48:53 +01:00
_stateService = stateService;
}
[Route("nblood/home", Name = "Home")]
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);
return View(viewModel);
}
}
}