Update gestione ceck esistenza tipo report (da subfolder)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using EgwCoreLib.Lux.Data.DbModel.Sales;
|
||||
using EgwCoreLib.Lux.Data.Services.Catalog;
|
||||
using EgwCoreLib.Lux.Data.Services.Sales;
|
||||
|
||||
namespace Lux.API.Controllers
|
||||
@@ -13,10 +14,14 @@ namespace Lux.API.Controllers
|
||||
/// Costruttore metodo
|
||||
/// </summary>
|
||||
/// <param name="offService"></param>
|
||||
public ReportController(IOfferService offService, IOrderService ordService)
|
||||
public ReportController(
|
||||
IOfferService offService,
|
||||
IOrderService ordService,
|
||||
ITemplateService tplService)
|
||||
{
|
||||
_offService = offService;
|
||||
_ordService = ordService;
|
||||
_tplService = tplService;
|
||||
// Configurazione serializzatore JSON per risolvere errore di loop circolare
|
||||
JSSettings = new JsonSerializerSettings()
|
||||
{
|
||||
@@ -40,7 +45,7 @@ namespace Lux.API.Controllers
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
// recupera dal DB l'offerta con le righe relative
|
||||
OfferModel? offData = await _offService.GetByIdAsync(id);
|
||||
var offData = await _offService.GetByIdAsync(id);
|
||||
|
||||
sw.Stop();
|
||||
Log.Info($"Offert | {id} | {sw.Elapsed.TotalMilliseconds:N3} ms");
|
||||
@@ -65,6 +70,25 @@ namespace Lux.API.Controllers
|
||||
return Ok(ordData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiamata GET: riceve TemplateID, restituisce Json Template (catalogo) + righe
|
||||
/// GET: api/report/offert/1
|
||||
/// </summary>
|
||||
/// <param name="id">id univoco</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("template/{id}")]
|
||||
public async Task<IActionResult> Template(int id)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
// recupera dal DB l'offerta con le righe relative
|
||||
var ordData = await _tplService.GetByIdAsync(id);
|
||||
|
||||
sw.Stop();
|
||||
Log.Info($"Template | {id} | {sw.Elapsed.TotalMilliseconds:N3} ms");
|
||||
return Ok(ordData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiamata GET: riceve ELENCO Offerte dato periodo
|
||||
/// GET: api/report/offert-list/?from=2026-01-01&to=2026-04-01
|
||||
@@ -104,6 +128,7 @@ namespace Lux.API.Controllers
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private IOfferService _offService;
|
||||
private IOrderService _ordService;
|
||||
private ITemplateService _tplService;
|
||||
private JsonSerializerSettings JSSettings;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
Reference in New Issue
Block a user