43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// Oggetto adapter condiviso da WebAPI
|
|
/// </summary>
|
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
|
|
|
[Route("current"), HttpGet]
|
|
public IHttpActionResult GetSchedTask()
|
|
{
|
|
// chiamo metodo di lettura...
|
|
List<Model.DTOModels.ThSchedulModels.DTOSchedTaskModels> dataRead = NcFileAdapter.LoadSchedTask();
|
|
return Ok(dataRead);
|
|
}
|
|
|
|
|
|
[Route("update"), HttpPut]
|
|
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)]
|
|
public IHttpActionResult WriteSchedTask(List<Model.DTOModels.ThSchedulModels.DTOSchedTaskModels> schedTaskList)
|
|
{
|
|
if (schedTaskList != null)
|
|
{
|
|
// salvo in memoria
|
|
NcFileAdapter.LiveSchedTask = schedTaskList;
|
|
// salvo su disco
|
|
NcFileAdapter.SaveSchedTask();
|
|
}
|
|
return Ok();
|
|
}
|
|
|
|
}
|
|
} |