55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using Step.CmsConnectGateway;
|
|
using Step.CmsConnectGateway.Exceptions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Http;
|
|
|
|
namespace Step.Controllers.WebApi
|
|
{
|
|
[RoutePrefix("api/cms_connect")]
|
|
public class CmsConnectController : ApiController
|
|
{
|
|
[Route("runConnectionTest"), HttpGet]
|
|
public IHttpActionResult RunConnectionTest()
|
|
{
|
|
using(GatewayAdapter Adp = new GatewayAdapter(Config.ServerConfig.CmsConnectConfig.Gateway.Address, Config.ServerConfig.CmsConnectConfig.Gateway.Username, Config.ServerConfig.CmsConnectConfig.Gateway.Password))
|
|
{
|
|
|
|
try
|
|
{
|
|
GatewayConnectionStatus sts = Adp.TestGatewayConnection(5);
|
|
return Ok(sts.ToString());
|
|
}
|
|
catch (GatewayException e)
|
|
{
|
|
return InternalServerError(e);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Route("getGatewayNetworkSetup"), HttpGet]
|
|
public IHttpActionResult GetGatewayNetworkSetup()
|
|
{
|
|
using (GatewayAdapter Adp = new GatewayAdapter(Config.ServerConfig.CmsConnectConfig.Gateway.Address, Config.ServerConfig.CmsConnectConfig.Gateway.Username, Config.ServerConfig.CmsConnectConfig.Gateway.Password))
|
|
{
|
|
|
|
try
|
|
{
|
|
GatewayNetworkConfiguration config = Adp.ReadGatewayNetworkConfiguration();
|
|
return Ok(config);
|
|
}
|
|
catch (GatewayException e)
|
|
{
|
|
return InternalServerError(e);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|