e8e8d8928b
Added Tools Data Api
41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using Step.NC;
|
|
using System.Collections.Generic;
|
|
using System.Web.Http;
|
|
using static CMS_CORE_Library.DataStructures;
|
|
|
|
namespace Step.Controllers.WebApi
|
|
{
|
|
[RoutePrefix("api/tool_table")]
|
|
public class ToolTableController : ApiController
|
|
{
|
|
[Route("configuration"), HttpGet]
|
|
public IHttpActionResult GetToolTableConfiguration()
|
|
{
|
|
using (NcHandler ncHandler = new NcHandler())
|
|
{
|
|
ncHandler.Connect();
|
|
CmsError libraryError = ncHandler.GetToolTableConfiguration(out ToolTableConfiguration toolTableConfiguration);
|
|
if (libraryError.IsError())
|
|
if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED)
|
|
return BadRequest(libraryError.message);
|
|
|
|
return Ok(toolTableConfiguration);
|
|
}
|
|
}
|
|
|
|
[Route("tools"), HttpGet]
|
|
public IHttpActionResult GetToolTableData()
|
|
{
|
|
using (NcHandler ncHandler = new NcHandler())
|
|
{
|
|
ncHandler.Connect();
|
|
CmsError libraryError = ncHandler.GetToolTableData(out List<SiemensToolModel> tools);
|
|
if (libraryError.IsError())
|
|
if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED)
|
|
return BadRequest(libraryError.message);
|
|
|
|
return Ok(tools);
|
|
}
|
|
}
|
|
}
|
|
} |