Removed HttpContext.Session
This commit is contained in:
@ -9,13 +9,11 @@ using System.Text.Json;
|
||||
public class PinController : Controller, IPinController<IActionResult>
|
||||
{
|
||||
|
||||
private readonly ILogger _Logger;
|
||||
private readonly IPinRepository _PinRepository;
|
||||
private readonly IMetrologyRepository _MetrologyRepository;
|
||||
|
||||
public PinController(ILogger<InboundController> logger, IMetrologyRepository metrologyRepository, IPinRepository pinRepository)
|
||||
{
|
||||
_Logger = logger;
|
||||
_MetrologyRepository = metrologyRepository;
|
||||
_PinRepository = pinRepository;
|
||||
}
|
||||
@ -23,23 +21,13 @@ public class PinController : Controller, IPinController<IActionResult>
|
||||
[HttpPost("/api/pin/markAsPinned")]
|
||||
public IActionResult MarkAsPinned(Shared.DataModels.HeaderCommon headerCommon)
|
||||
{
|
||||
string toolTypeId = headerCommon.ToolTypeID.ToString();
|
||||
string json = JsonSerializer.Serialize(headerCommon, new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||
string? was = HttpContext.Session.GetString(toolTypeId);
|
||||
if (was is not null)
|
||||
_Logger.LogDebug($"{toolTypeId} was: {was}");
|
||||
HttpContext.Session.SetString(toolTypeId, json);
|
||||
_PinRepository.SetPinnedTable(headerCommon);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{id}/pinned/{rds}")]
|
||||
public IActionResult GetPinnedTable(int id, string rds = "")
|
||||
{
|
||||
string? cde = HttpContext.Session.GetString(((int)IPinRepository.ToolId.CDE).ToString());
|
||||
string? bioRad = HttpContext.Session.GetString(((int)IPinRepository.ToolId.BioRad).ToString());
|
||||
return Json(_PinRepository.GetPinnedTable(_MetrologyRepository, id, rds, bioRad, cde), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||
}
|
||||
[Route("{id}/pinned")]
|
||||
public IActionResult GetPinnedTable(int id, string? biorad_id = null, string? cde_id = null, string? rds = null) =>
|
||||
Json(_PinRepository.GetPinnedTable(_MetrologyRepository, id, biorad_id, cde_id, rds), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||
|
||||
}
|
Reference in New Issue
Block a user