using MagMan.Data.Admin.DbModels; using MagMan.Data.Admin.Services; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using NLog; namespace MagMan.UI.Controllers { [Route("api/[controller]")] [ApiController] public class MachinesController : ControllerBase { /// /// Classe per logging /// private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); private MTAdminService _DataService { get; set; } = null!; public MachinesController(MTAdminService DataService) { _DataService = DataService; Log.Info("Avviata classe MachinesController"); } /// /// Controllo status Alive /// GET: api/Machines/alive /// /// [HttpGet("alive")] public string alive() { //Log.Debug("Chiamata alive"); return $"OK"; } // GET api/Machines/5 [HttpGet] public async Task> Get() { // se non ho chiave --> vuoto! List ListRecords = new List(); await Task.Delay(100); return ListRecords; } /// /// Elenco Macchine dato RestToken /// /// Rest Token cliente /// // GET api/Machines/2cba60c7-7be4-40b1-aa0d-52e7c71fc1a7 [HttpGet("{id}")] public async Task> Get(string id) { var ListRecords = await _DataService.MachineGetByToken(id); return ListRecords; } } }