RobotApp/RobotApp/Controllers/OrderController.cs
Đăng Nguyễn 1289a6c331 update
2025-12-22 18:39:38 +07:00

39 lines
893 B
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using RobotApp.Interfaces;
using RobotApp.VDA5050.Order;
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"
});
}
}