ancora fix deploy IOC

This commit is contained in:
Samuele Locatelli
2023-04-04 16:37:44 +02:00
parent 9525fd3726
commit 5c585f6b7f
10 changed files with 321 additions and 180 deletions
+39 -28
View File
@@ -1,12 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
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
{
@@ -15,10 +10,7 @@ namespace MP.SPEC.Controllers
[AllowAnonymous]
public class RecipeArchiveController : ControllerBase
{
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected MpDataService DService { get; set; }
#region Public Constructors
public RecipeArchiveController(IConfiguration configuration, MpDataService DataService)
{
@@ -26,27 +18,12 @@ namespace MP.SPEC.Controllers
_configuration = configuration;
DService = DataService;
Log.Info("Avviata classe RecipeArchiveController");
}
private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Public Constructors
#region Public Methods
[HttpGet("GetFile")]
public async Task<string> GetFile(string idxMacc, string fileName)
{
string answ = "";
string archPath = await DService.MacchineRecipeArchive(idxMacc);
if (!string.IsNullOrEmpty(archPath))
{
string fullPath = Path.Combine(archPath, fileName);
if (!string.IsNullOrEmpty(fullPath))
{
answ = System.IO.File.ReadAllText(fullPath);
}
}
return answ;
}
[HttpGet("GetByPODL")]
public async Task<string> GetByPODL(string idxMacc, int idxPODL)
{
@@ -65,5 +42,39 @@ namespace MP.SPEC.Controllers
return answ;
}
[HttpGet("GetFile")]
public async Task<string> GetFile(string idxMacc, string fileName)
{
string answ = "";
string archPath = await DService.MacchineRecipeArchive(idxMacc);
if (!string.IsNullOrEmpty(archPath))
{
string fullPath = Path.Combine(archPath, fileName);
if (!string.IsNullOrEmpty(fullPath))
{
answ = System.IO.File.ReadAllText(fullPath);
}
}
return answ;
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected MpDataService DService { get; set; }
#endregion Protected Properties
#region Private Fields
private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
}