using Application.Models; using IoT.Shared.Controllers; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; using System; namespace FBeeService.Controllers { [SwaggerTag("1路开关")] public class SwitchController : BaseDeviceController { private readonly DeviceService _deviceService; public SwitchController(IServiceProvider applicationServices, DeviceService deviceService) : base(applicationServices) { this._deviceService = deviceService; } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("开")] public ApiResponse On(string gateway, string id) { return this.AsyncAction(() => { this._deviceService.X82(gateway, id, 1); }); } [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("关")] public ApiResponse Off(string gateway, string id) { return this.AsyncAction(() => { this._deviceService.X82(gateway, id, 0); }); } } }