51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using CMS_CORE_Library.Models;
|
|
using Thermo.Active.Model.DTOModels;
|
|
using Thermo.Active.NC;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Http;
|
|
using static CMS_CORE_Library.Models.DataStructures;
|
|
using static Thermo.Active.Config.ServerConfig;
|
|
using static Thermo.Active.Model.Constants;
|
|
using Thermo.Active.Model.DTOModels.Recipe;
|
|
|
|
namespace Thermo.Active.Controllers.WebApi
|
|
{
|
|
[RoutePrefix("api/recipe")]
|
|
public class RecipeController : ApiController
|
|
{
|
|
[Route("overview"), HttpGet]
|
|
public IHttpActionResult GetOverview()
|
|
{
|
|
using (NcAdapter ncAdapter = new NcAdapter())
|
|
{
|
|
// serve?!?!?
|
|
//ncAdapter.Connect();
|
|
CmsError cmsError = ncAdapter.GetRecipeOverview(out Dictionary<string, RecipeCatStatus> currOverview);
|
|
if (cmsError.IsError())
|
|
return BadRequest(cmsError.localizationKey);
|
|
|
|
return Ok(currOverview);
|
|
}
|
|
}
|
|
[Route("current"), HttpGet]
|
|
public IHttpActionResult GetCurrentParameters()
|
|
{
|
|
using (NcAdapter ncAdapter = new NcAdapter())
|
|
{
|
|
// serve?!?!?
|
|
//ncAdapter.Connect();
|
|
CmsError cmsError = ncAdapter.ReadFullRecipe(out Dictionary<string, DTORecipeParam> currentRecipe);
|
|
if (cmsError.IsError())
|
|
return BadRequest(cmsError.localizationKey);
|
|
|
|
return Ok(currentRecipe);
|
|
}
|
|
}
|
|
}
|
|
} |