- aggiunta output XML
- fix struttura dati
This commit is contained in:
Samuele Locatelli
2023-02-13 13:15:37 +01:00
parent 0b40b0cd22
commit 5bf47fd008
10 changed files with 35 additions and 16 deletions
+18 -1
View File
@@ -3,7 +3,9 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using MP.Data.MgModels;
using MP.SPEC.Data;
using Newtonsoft.Json;
using NLog;
using System.Xml;
namespace MP.SPEC.Controllers
{
@@ -33,11 +35,26 @@ namespace MP.SPEC.Controllers
{
string answ = "";
var reqRecipe = await DService.RecipeGetByPODL(idxPODL);
if(reqRecipe!=null)
if (reqRecipe != null)
{
answ = DService.CalcRecipe(reqRecipe);
}
return answ;
}
[HttpGet("GetRecipeXML")]
public async Task<string> GetRecipeXML(int idxPODL)
{
string answ = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
// recupero versione json
string rawData = await GetRecipe(idxPODL);
if (!string.IsNullOrEmpty(rawData))
{
// aggiungo root node?
XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(rawData);
answ += doc.InnerXml;
}
return answ;
}
}
}