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

31 lines
943 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 async Task<IActionResult> Index(CancellationToken cancellationToken)
{
var model = new VerificationDashboardViewModel
{
RecentScans = await _scanHistoryStore.GetLastFiveAsync(cancellationToken)
};
return View(model);
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}