45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Http;
|
|
using CMS_CORE;
|
|
using Step.Model.DTOModels;
|
|
using Step.NC;
|
|
using static CMS_CORE.Nc;
|
|
using static CMS_CORE_Library.DataStructures;
|
|
using static Step.Utils.Constants;
|
|
|
|
namespace Step.Controllers.WebApi
|
|
{
|
|
[RoutePrefix("api/nc")]
|
|
public class NcApiController : ApiController
|
|
{
|
|
[Route("generic_data"), HttpGet]
|
|
[WebApiAuthorize(FunctionAccess = "ncData", Action = ACTIONS.READ)]
|
|
public IHttpActionResult GetNcGenericData()
|
|
{
|
|
Stopwatch stop = new Stopwatch();
|
|
stop.Start();
|
|
try
|
|
{
|
|
using (NcHandler ncHandler = new NcHandler())
|
|
{
|
|
ncHandler.Connect();
|
|
CmsError libraryError = ncHandler.GetNcGenericData(out DTONcGenericDataModel genericData);
|
|
if (libraryError.errorCode != 0)
|
|
return Ok(libraryError.message);
|
|
|
|
return Ok(genericData);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return InternalServerError(ex);
|
|
}
|
|
}
|
|
}
|
|
}
|