ancora fix deploy IOC
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MP.IOC.Data;
|
||||
using NLog;
|
||||
|
||||
namespace MP.IOC.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class RecipeArchiveController : ControllerBase
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public RecipeArchiveController(IConfiguration configuration, MpDataService DataService)
|
||||
{
|
||||
Log.Info("Starting RecipeArchiveController");
|
||||
_configuration = configuration;
|
||||
DService = DataService;
|
||||
Log.Info("Avviata classe RecipeArchiveController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
[HttpGet("GetByPODL")]
|
||||
public async Task<string> GetByPODL(string idxMacc, int idxPODL)
|
||||
{
|
||||
string answ = "";
|
||||
string archPath = await DService.MacchineRecipeArchive(idxMacc);
|
||||
var podlData = await DService.POdlGetByKey(idxPODL);
|
||||
if (podlData != null)
|
||||
{
|
||||
string fileName = podlData?.Recipe ?? "";
|
||||
string fullPath = Path.Combine(archPath, fileName);
|
||||
if (!string.IsNullOrEmpty(fullPath))
|
||||
{
|
||||
answ = System.IO.File.ReadAllText(fullPath);
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user