| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using Admin.NET.Plugin.AiDOP.Entity.S8;
- using Admin.NET.Plugin.AiDOP.Service.S8;
- namespace Admin.NET.Plugin.AiDOP.Controllers.S8;
- [ApiController]
- [Route("api/aidop/s8/config/scenes")]
- [NonUnify]
- public class AdoS8ConfigScenesController : ControllerBase
- {
- private readonly S8SceneConfigService _svc;
- public AdoS8ConfigScenesController(S8SceneConfigService svc) => _svc = svc;
- [HttpGet]
- public async Task<IActionResult> ListAsync([FromQuery] long tenantId = 1, [FromQuery] long factoryId = 1) =>
- Ok(await _svc.ListAsync(tenantId, factoryId));
- [HttpPost]
- public async Task<IActionResult> CreateAsync([FromBody] AdoS8SceneConfig body)
- {
- try { return Ok(await _svc.CreateAsync(body)); }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- [HttpPut("{id:long}")]
- public async Task<IActionResult> UpdateAsync(long id, [FromBody] AdoS8SceneConfig body)
- {
- try { return Ok(await _svc.UpdateAsync(id, body)); }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- [HttpDelete("{id:long}")]
- public async Task<IActionResult> DeleteAsync(long id)
- {
- await _svc.DeleteAsync(id);
- return Ok();
- }
- }
|