初始化
This commit is contained in:
47
WebAPIServer/Controllers/ValuesController.cs
Normal file
47
WebAPIServer/Controllers/ValuesController.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ViewModels;
|
||||
using WebAPIServer.Common;
|
||||
|
||||
namespace WebAPIServer.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class ValuesController : ControllerBase
|
||||
{
|
||||
[HttpGet()]
|
||||
public ReturnInfo GetAll_WebApiMethod(string VariableName)
|
||||
{
|
||||
ReturnInfo i = new ReturnInfo();
|
||||
i.isok = true;
|
||||
try
|
||||
{
|
||||
var result = StaticData.scope.GetVariable(VariableName);
|
||||
i.response = result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
i.isok = false;
|
||||
i.message = ex.Message;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
[HttpPost()]
|
||||
public ReturnInfo UpdateData()
|
||||
{
|
||||
ReturnInfo i = new ReturnInfo();
|
||||
i.isok = true;
|
||||
try
|
||||
{
|
||||
StaticData.GetWebAPIMethod();
|
||||
i.response = "sucess";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
i.isok = false;
|
||||
i.message = ex.Message;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user