Files
cms_thermo_active/Step/Controllers/WebApi/NcApiController.cs
T
CMS3762\carminatini be173af2dd Removed Login_Required from Language
Added login in Swagger
Bug Fixed
2018-01-09 14:17:28 +01:00

43 lines
1.2 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 Step.Utils.Constants;
namespace Step.Controllers.WebApi
{
[RoutePrefix("api/nc")]
public class NcApiController : ApiController
{
[Route("generic_data"), HttpGet]
[WebApiAuthorize(FunctionAccess = "test", Action = ACTIONS.READ)]
public IHttpActionResult GetNcGenericData()
{
DTONcGenericDataModel genericData = new DTONcGenericDataModel();
Stopwatch stop = new Stopwatch();
stop.Start();
try
{
using (NcHandler ncHandler = new NcHandler())
{
ncHandler.Connect();
genericData = ncHandler.GetNcGenericData();
}
}
catch (Exception ex)
{
return InternalServerError(ex);
}
Console.WriteLine("API" + stop.ElapsedMilliseconds);
return Ok(genericData);
}
}
}