oi-metrology/Wafer-Counter/ApiControllers/WaferCounterController.cs
2024-08-28 15:58:20 -07:00

27 lines
1.0 KiB
C#

using Microsoft.AspNetCore.Mvc;
using OI.Metrology.Shared.Models.Stateless;
namespace OI.Metrology.Wafer.Counter.ApiControllers;
[Route("api/v1/[controller]")]
public class WaferCounterController : Controller, IWaferCounterController<IActionResult>
{
private readonly IWaferCounterRepository _WaferCounterRepository;
public WaferCounterController(IWaferCounterRepository waferCounterRepository) =>
_WaferCounterRepository = waferCounterRepository;
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[HttpGet("{waferSize}/last-quantity-and-slot-map")]
public IActionResult GetLastQuantityAndSlotMap(string area, string waferSize, string text)
{
Shared.DataModels.WaferCounter? waferCounter = _WaferCounterRepository.GetLastQuantityAndSlotMap(area, waferSize, text);
if (waferCounter is null)
return BadRequest();
else if (!string.IsNullOrEmpty(waferCounter.Message))
return BadRequest(waferCounter.Message);
else
return Json(waferCounter);
}
}