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 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); } } } }