diff --git a/Thermo.Active.Model/DTOModels/ThRecipe/LiveData.cs b/Thermo.Active.Model/DTOModels/ThRecipe/LiveData.cs index 74947f35..da3ed846 100644 --- a/Thermo.Active.Model/DTOModels/ThRecipe/LiveData.cs +++ b/Thermo.Active.Model/DTOModels/ThRecipe/LiveData.cs @@ -31,6 +31,10 @@ namespace Thermo.Active.Model.DTOModels.ThRecipe /// Last TC observed (stats) in sec /// public double TC_last = 3600; + /// + /// Note ricetta + /// + public string recipeNotes = ""; } diff --git a/Thermo.Active/Controllers/WebApi/RecipeController.cs b/Thermo.Active/Controllers/WebApi/RecipeController.cs index 59a4057d..e9408c75 100644 --- a/Thermo.Active/Controllers/WebApi/RecipeController.cs +++ b/Thermo.Active/Controllers/WebApi/RecipeController.cs @@ -474,10 +474,23 @@ namespace Thermo.Active.Controllers.WebApi return Ok(); } + [Route("updateNote"), HttpPost] + [WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)] + public IHttpActionResult UpdateNote(string recipeNotes) + { + // salvo note... + if (!string.IsNullOrEmpty(recipeNotes)) + { + NcFileAdapter.RecipeLiveData.recipeNotes = recipeNotes.Trim(); + } + // e salvo su disco + NcFileAdapter.SaveRecipe(NcFileAdapter.RecipeLiveData.RecipeName, NcFileAdapter.RecipeLiveData); + return Ok(); + } [Route("saveAll"), HttpPost] [WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)] - public async Task SaveAll(string newName, double estimTimeSec) + public async Task SaveAll(string newName, string recipeNotes, double estimTimeSec) { // recupero dati utente loggato var identity = User.Identity as ClaimsIdentity; @@ -492,6 +505,12 @@ namespace Thermo.Active.Controllers.WebApi NcFileAdapter.RecipeLiveData.UserSave = userData.Id.ToString(); } + // salvo note... + if(!string.IsNullOrEmpty(recipeNotes)) + { + NcFileAdapter.RecipeLiveData.recipeNotes = recipeNotes.Trim(); + } + bool imageUploaded = false; if (!Request.Content.IsMimeMultipartContent()) @@ -538,7 +557,6 @@ namespace Thermo.Active.Controllers.WebApi // e salvo su disco NcFileAdapter.SaveRecipe(newName, NcFileAdapter.RecipeLiveData); } - return Ok(); }