first commit -push
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
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<DashboardConfigController> Logger) : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public Task<MessageResult<string[]>> GetOpenACSSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Task.FromResult<MessageResult<string[]>>(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<MessageResult<string[]>>(new(false, "Hệ thống có lỗi xảy ra"));
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<MessageResult> 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user