Added Viewer and

change to App Setting File from Constants
This commit is contained in:
2022-07-27 10:47:57 -07:00
parent 2afec95704
commit b155863645
1012 changed files with 53014 additions and 110896 deletions

View File

@ -0,0 +1,60 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using OI.Metrology.Shared.Repositories;
using OI.Metrology.Shared.ViewModels;
using OI.Metrology.Viewer.Models;
using System;
namespace OI.Metrology.Viewer.Controllers;
public class PagesController : Controller
{
private readonly IMetrologyRepo _Repo;
private readonly bool _IsTestDatabase;
public PagesController(AppSettings appSettings, IMetrologyRepo repo)
{
_Repo = repo;
_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")]
public IActionResult AwaitingDispo() => View();
[HttpGet]
[Route("/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 = _Repo.GetHeaderAttachmentID(tooltypeid, headerid);
}
return View(m);
}
[HttpGet]
[Route("/RunHeaders")]
public IActionResult RunHeaders() => View();
[HttpGet]
[Route("/Crash")]
public IActionResult Crash() => throw new Exception("Test unhandled exception");
}