Spreading Resistance Profile with ChartJS,
Copy-On-Get and nuget bump (Serilog)
This commit is contained in:
@ -0,0 +1,38 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using OI.Metrology.Shared.Services;
|
||||
|
||||
namespace OI.Metrology.Server.ApiControllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public partial class SpreadingResistanceProfileController : ControllerBase, ISpreadingResistanceProfileController<IActionResult>
|
||||
{
|
||||
|
||||
private readonly IAttachmentsService _AttachmentsService;
|
||||
private readonly IMetrologyRepository _MetrologyRepository;
|
||||
private readonly IToolTypesRepository _ToolTypesRepository;
|
||||
private readonly ISpreadingResistanceProfileService _SpreadingResistanceProfileService;
|
||||
|
||||
public SpreadingResistanceProfileController(IMetrologyRepository metrologyRepository, IAttachmentsService attachmentsService, IToolTypesRepository toolTypesRepository, ISpreadingResistanceProfileService spreadingResistanceProfileService)
|
||||
{
|
||||
_MetrologyRepository = metrologyRepository;
|
||||
_AttachmentsService = attachmentsService;
|
||||
_ToolTypesRepository = toolTypesRepository;
|
||||
_SpreadingResistanceProfileService = spreadingResistanceProfileService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{toolTypeId}/{tabletype}/files/{attachmentId}/{filename}")]
|
||||
public IActionResult GetAttachment(int toolTypeId, string tabletype, string attachmentId, string filename)
|
||||
{
|
||||
(string? message, string? contenttype, Stream? stream) = _ToolTypesRepository.GetAttachment(_MetrologyRepository, _AttachmentsService, toolTypeId, tabletype, attachmentId, filename);
|
||||
if (message is not null)
|
||||
return Content(message);
|
||||
else if (contenttype is not null && stream is not null)
|
||||
return File(_SpreadingResistanceProfileService.GetImageBytes(stream), "image/jpeg");
|
||||
else
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user