using CMS_CORE_Library.Models; using System.Collections.Generic; using System.Web.Http; using Thermo.Active.Model.DTOModels.ThModules; using Thermo.Active.NC; using Thermo.Active.Utils; using static Thermo.Active.Model.Constants; namespace Thermo.Active.Controllers.WebApi { [RoutePrefix("api/SchedTask")] public class SchedTaskController : ApiController { /// /// Oggetto adapter condiviso da WebAPI /// protected static NcAdapter ncAdapter = new NcAdapter(); [Route("current"), HttpGet] public IHttpActionResult GetSchedTask() { // chiamo metodo di lettura... List dataRead = NcFileAdapter.LoadSchedTask(); return Ok(dataRead); } [Route("update"), HttpPut] [WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)] public IHttpActionResult WriteSchedTask(List schedTaskList) { if (schedTaskList != null) { // salvo in memoria NcFileAdapter.LiveSchedTask = schedTaskList; // salvo su disco NcFileAdapter.SaveSchedTask(); } return Ok(); } } }