54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
|
using Microsoft.AspNetCore.Http;
|
|||
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
|||
|
namespace ImplementerApp.Controllers
|
|||
|
{
|
|||
|
public class ChartController : Controller
|
|||
|
{
|
|||
|
private readonly ILogger<ChartController> _logger;
|
|||
|
private readonly ImplementerData _data;
|
|||
|
public ChartController(ILogger<ChartController> logger, ImplementerData data)
|
|||
|
{
|
|||
|
_logger = logger;
|
|||
|
_data = data;
|
|||
|
}
|
|||
|
private bool IsLoggedIn { get { return UserImplementer.user != null; } }
|
|||
|
private int UserId { get { return UserImplementer.user!.Id; } }
|
|||
|
[HttpGet]
|
|||
|
public IActionResult ProductHistogramm()
|
|||
|
{
|
|||
|
if (!IsLoggedIn)
|
|||
|
return RedirectToAction("IndexNonReg", "Home");
|
|||
|
try {
|
|||
|
var chart = _data.GetProductChart(UserId);
|
|||
|
return View(chart);
|
|||
|
} catch
|
|||
|
{
|
|||
|
return RedirectToAction("IndexNonReg", "Home");
|
|||
|
}
|
|||
|
}
|
|||
|
public IActionResult Menu()
|
|||
|
{
|
|||
|
if (!IsLoggedIn)
|
|||
|
return RedirectToAction("IndexNonReg", "Home");
|
|||
|
return View();
|
|||
|
}
|
|||
|
[HttpGet]
|
|||
|
public IActionResult ProductionHistogramm()
|
|||
|
{
|
|||
|
|
|||
|
if (!IsLoggedIn)
|
|||
|
return RedirectToAction("IndexNonReg", "Home");
|
|||
|
try
|
|||
|
{
|
|||
|
var chart = _data.GetProductionChart(UserId);
|
|||
|
return View(chart);
|
|||
|
}
|
|||
|
catch
|
|||
|
{
|
|||
|
return RedirectToAction("IndexNonReg", "Home");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|