39 lines
916 B
C#
39 lines
916 B
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using RobotApp.Interfaces;
|
|
using RobotApp.VDA5050.Order;
|
|
using System.Text.Json;
|
|
|
|
namespace RobotApp.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/order")]
|
|
//[Authorize]
|
|
[AllowAnonymous]
|
|
public class OrderController(IOrder robotOrderController, IInstantActions instantActions) : ControllerBase
|
|
{
|
|
[HttpPost]
|
|
public IActionResult SendOrder([FromBody] OrderMsg order)
|
|
{
|
|
robotOrderController.UpdateOrder(order);
|
|
return Ok(new
|
|
{
|
|
success = true,
|
|
message = "Order received"
|
|
});
|
|
}
|
|
|
|
[HttpPost("cancel")]
|
|
public IActionResult CancelOrder()
|
|
{
|
|
robotOrderController.StopOrder();
|
|
instantActions.StopOrderAction();
|
|
|
|
return Ok(new
|
|
{
|
|
success = true,
|
|
message = "Order and actions have been cancelled"
|
|
});
|
|
}
|
|
}
|