Ricetta:
- aggiunta output XML - fix struttura dati
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user