64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.Filters;
|
|
using OI.Metrology.Server.Models;
|
|
using OI.Metrology.Shared.Models.Stateless;
|
|
using OI.Metrology.Shared.ViewModels;
|
|
|
|
namespace OI.Metrology.Server.Controllers;
|
|
|
|
public class PagesController : Controller
|
|
{
|
|
private readonly bool _IsTestDatabase;
|
|
private readonly IMetrologyRepository _MetrologyRepository;
|
|
|
|
public PagesController(AppSettings appSettings, IMetrologyRepository metrologyRepository)
|
|
{
|
|
_MetrologyRepository = metrologyRepository;
|
|
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
|
|
}
|
|
|
|
public override void OnActionExecuted(ActionExecutedContext context)
|
|
{
|
|
base.OnActionExecuted(context);
|
|
ViewBag.IsTestDatabase = _IsTestDatabase;
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("/")]
|
|
public IActionResult Index() =>
|
|
View("AwaitingDispo");
|
|
|
|
[HttpGet]
|
|
[Route("/AwaitingDispo")]
|
|
[Route("/Metrology/AwaitingDispo")]
|
|
public IActionResult AwaitingDispo() =>
|
|
View();
|
|
|
|
[HttpGet]
|
|
[Route("/RunInfo")]
|
|
[Route("/Metrology/RunInfo")]
|
|
public IActionResult RunInfo([FromQuery] int tooltypeid = 1, [FromQuery] int headerid = 0)
|
|
{
|
|
RunInfo m = new()
|
|
{
|
|
ToolTypeID = tooltypeid,
|
|
HeaderID = headerid,
|
|
HeaderAttachmentID = Guid.Empty,
|
|
};
|
|
if (headerid > 0)
|
|
{
|
|
m.HeaderAttachmentID = _MetrologyRepository.GetHeaderAttachmentID(tooltypeid, headerid);
|
|
}
|
|
return View(m);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("/RunHeaders")]
|
|
[Route("/Metrology/RunHeaders")]
|
|
public IActionResult RunHeaders() =>
|
|
View();
|
|
|
|
[HttpGet]
|
|
[Route("/Crash")]
|
|
public IActionResult Crash() => throw new Exception("Test unhandled exception");
|
|
} |