using Microsoft.AspNetCore.Mvc; using RobotNet.ScriptManager.Services; using RobotNet.Shares; namespace RobotNet.ScriptManager.Controllers; [Route("api/[controller]")] [ApiController] public class DashboardConfigController(DashboardConfig Config, ILogger Logger) : ControllerBase { [HttpGet] public Task> GetOpenACSSettings() { try { return Task.FromResult>(new(true, "") { Data = Config.MissionNames }); } catch (Exception ex) { Logger.LogWarning($"Lấy cấu hình OpenACS xảy ra lỗi: {ex.Message}"); return Task.FromResult>(new(false, "Hệ thống có lỗi xảy ra")); } } [HttpPost] public async Task UpdatePublishSetting([FromBody] string[] missionNames) { try { await Config.UpdateMissionNames(missionNames); return new(true, ""); } catch (Exception ex) { Logger.LogWarning($"Cập nhật cấu hình publish OpenACS xảy ra lỗi: {ex.Message}"); return new(false, "Hệ thống có lỗi xảy ra"); } } }