Files
cms_thermo_active/Thermo.Active/Controllers/WebApi/StarredUserSoftKeyController.cs
T
2020-07-14 19:25:49 +02:00

39 lines
1.2 KiB
C#

using CMS_CORE_Library.Models;
using System.Collections.Generic;
using System.Web.Http;
using Thermo.Active.Model.DTOModels;
using Thermo.Active.NC;
using Thermo.Active.Utils;
namespace Thermo.Active.Controllers.WebApi
{
[RoutePrefix("api/starred_softkey")]
public class StarredUserSoftKeyController : ApiController
{
/// <summary>
/// Oggetto adapter condiviso da WebAPI
/// </summary>
protected static NcAdapter ncAdapter = new NcAdapter();
[Route("get"), HttpGet]
public IHttpActionResult GetStarredUserSoftkey()
{
// // Try connection
CmsError libraryError = ncAdapter.Connect();
if (libraryError.IsError())
{
ThermoActiveLogger.LogError($"ncAdapter Not connected! | GetOverview | {libraryError.exception}");
}
libraryError = ncAdapter.GetStarredUserSoftKeys(out List <DTOUserSoftKeyModel> softKeys);
if (libraryError.IsError())
{
ThermoActiveLogger.LogError($"GetStarredUserSoftkey error | {libraryError.exception}");
return BadRequest(libraryError.localizationKey);
}
return Ok(softKeys);
}
}
}