AVS-Carton-Shipment-Verifier/Controllers/HomeController.cs

31 lines
868 B
C#

using System.Diagnostics;
using AVSCartonShipmentVerifier.Models;
using AVSCartonShipmentVerifier.Services;
using AVSCartonShipmentVerifier.ViewModels;
using Microsoft.AspNetCore.Mvc;
namespace AVSCartonShipmentVerifier.Controllers;
public sealed class HomeController(IScanHistoryStore scanHistoryStore) : Controller
{
private readonly IScanHistoryStore _scanHistoryStore = scanHistoryStore;
[HttpGet]
public IActionResult Index()
{
var model = new VerificationDashboardViewModel
{
RecentScans = _scanHistoryStore.GetLastFive()
};
return View(model);
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}