Files
mapo-core/MP.WASM.Mon/Server/Controllers/MSEController.cs
T
Samuele Locatelli 8f2afd8ab5 MON Server / WASM
- fine tuning cache
- test velocità recupero dati
2022-07-09 09:53:21 +02:00

100 lines
2.5 KiB
C#

using Microsoft.AspNetCore.Mvc;
using MP.Data.Conf;
using MP.Data.DatabaseModels;
using MP.WASM.Mon.Data;
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
namespace MP.WASM.Mon.Server.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class MSEController : ControllerBase
{
#region Public Constructors
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected MpDataService _DataService { get; set; }
/// <summary>
/// Avvio controller dei dati MSE
/// </summary>
/// <param name="DataService"></param>
public MSEController(MpDataService DataService)
{
_DataService = DataService;
Log.Info("Avviata classe MSEController");
}
#endregion Public Constructors
#region Public Properties
/// <summary>
/// Dizionario dei tag configurati per IOB
/// </summary>
public Dictionary<string, List<TagData>> currTagConf { get; set; } = new Dictionary<string, List<TagData>>();
#endregion Public Properties
#region Public Methods
[HttpGet("getConfig")]
public Task<List<ConfigModel>> ConfigGetAll()
{
return _DataService.ConfigGetAll();
}
/// <summary>
/// restituisce il valore da REDIS associato al tag richeisto
/// </summary>
/// <param name="redKey">Chiave in cui cercare il valore</param>
/// <returns></returns>
[HttpGet("getTagConf/{redKey}")]
public string getTagConf(string redKey)
{
return _DataService.getTagConf(redKey);
}
[HttpGet("getMachines")]
public Task<List<Macchine>> MacchineGetAll()
{
return _DataService.MacchineGetAll();
}
[HttpGet("getAllTagConf")]
public Task<Dictionary<string, List<TagData>>> getAllTags()
{
return _DataService.getAllTags();
}
/// <summary>
/// Metodo principale x ricevere tutte i dati MSE di tutti gli impianti
/// </summary>
/// <returns></returns>
[HttpGet()]
public Task<List<MappaStatoExpl>> MseGetAll()
{
return _DataService.MseGetAll();
}
#endregion Public Methods
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Methods
#endregion Private Methods
}
}