Files
FA_WEB/FaKrosnoApi/Controllers/ErrorLogController.cs
2025-01-24 13:37:01 +01:00

26 lines
847 B
C#

using Microsoft.AspNetCore.Mvc;
using SytelineSaAppEfDataModel.Dtos;
using SytelineSaAppEfDataModel.Services;
namespace FaKrosnoApi.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class ErrorLogController(IErrorLogService service) : Controller
{
[HttpGet]
public async Task<ActionResult<IEnumerable<ErrorLogDto>>> GetAll()
{
IEnumerable<ErrorLogDto?> errorLogs = await service.GetAll();
return Ok(errorLogs);
}
[HttpGet("by-order-number")]
public async Task<ActionResult<IEnumerable<ErrorLogDto>>> GetByCustomerOrderNumber([FromQuery] string customerOrderNumber)
{
var errorLogs = await service.GetByOrderNumber(customerOrderNumber);
return errorLogs.Any() ? Ok(errorLogs) : NotFound();
}
}
}