2
0
mirror of synced 2025-01-14 10:34:26 +00:00

36 lines
835 B
C#
Raw Normal View History

2024-09-11 12:08:06 +02:00
using Microsoft.AspNetCore.Mvc;
namespace AutoClientCenter.Controllers
{
[ApiController]
[Route("[controller]")]
public class TasksController : ControllerBase
{
private readonly ITaskService taskService;
private static readonly object processLock = new object();
public TasksController(ITaskService taskService)
{
this.taskService = taskService;
}
[HttpGet]
public AcTasks Get()
{
return taskService.GetTasks();
}
[HttpPost("Results")]
public void Post([FromBody] AcTaskStep[] taskSteps)
{
Task.Run(() =>
{
lock (processLock)
{
taskService.ProcessResults(taskSteps);
}
});
}
}
}