108 lines
3.6 KiB
C#
108 lines
3.6 KiB
C#
using LiMan.APi.Data;
|
|
using LiMan.DbSync.DbModels;
|
|
using LiMan.DbSync.Services;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using NLog;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LiMan.APi.Controllers
|
|
{
|
|
/// <summary>
|
|
/// Controller per sync tabelle standard
|
|
/// </summary>
|
|
[Route("api/dbsync")]
|
|
[ApiController]
|
|
public class DbSyncController : ControllerBase
|
|
{
|
|
#region Public Constructors
|
|
|
|
/// <summary>
|
|
/// Init generico
|
|
/// </summary>
|
|
/// <param name="DataService"></param>
|
|
public DbSyncController(ApiDataService DataService, DbSyncService SyncService)
|
|
{
|
|
mainDataService = DataService;
|
|
syncDataService = SyncService;
|
|
Log.Info("Avviata classe DbSyncController");
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// Recupera elenco dati Config x setup locale GET api/dbsync/conf/[id]?[CodApp]
|
|
/// </summary>
|
|
/// <param name="id">Codice cliente/Installazione</param>
|
|
/// <param name="CodApp">Codice Applicazione</param>
|
|
/// <returns></returns>
|
|
[HttpGet("conf/{id}")]
|
|
public async Task<List<ConfigModel>> Get(string id, string CodApp)
|
|
{
|
|
// ora recupero le info richieste dall'applicativo
|
|
List<ConfigModel> result = await syncDataService.ConfigGetAll(CodApp);
|
|
await mainDataService.recordCall(id, CodApp, $"GET:api/dbsync/conf/");
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera elenco dati AnagKeyVal x setup locale GET api/dbsync/anagkeyval/[id]?[CodApp]
|
|
/// </summary>
|
|
/// <param name="id">Codice cliente/Installazione</param>
|
|
/// <param name="CodApp">Codice Applicazione</param>
|
|
/// <returns></returns>
|
|
[HttpGet("anagkeyval/{id}")]
|
|
public async Task<List<AnagKeyValueModel>> GetAnagKeyVal(string id, string CodApp)
|
|
{
|
|
// ora recupero le info richieste dall'applicativo
|
|
List<AnagKeyValueModel> result = await syncDataService.AnagKeyValGetAll(CodApp);
|
|
await mainDataService.recordCall(id, CodApp, $"GET:api/dbsync/anagkeyval/");
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera elenco dati Vocabolario x setup locale GET api/dbsync/anagkeyval/[id]?[CodApp]
|
|
/// </summary>
|
|
/// <param name="id">Codice cliente/Installazione</param>
|
|
/// <param name="CodApp">Codice Applicazione</param>
|
|
/// <returns></returns>
|
|
[HttpGet("vocabolario/{id}")]
|
|
public async Task<List<VocabolarioModel>> GetVocabolario(string id, string CodApp)
|
|
{
|
|
// ora recupero le info richieste dall'applicativo
|
|
List<VocabolarioModel> result = await syncDataService.VocabolarioGetAll(CodApp);
|
|
await mainDataService.recordCall(id, CodApp, $"GET:api/dbsync/vocabolario/");
|
|
return result;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Properties
|
|
|
|
/// <summary>
|
|
/// Dataservice x accesso DB
|
|
/// </summary>
|
|
protected ApiDataService mainDataService { get; set; }
|
|
|
|
/// <summary>
|
|
/// Dataservice x accesso DB
|
|
/// </summary>
|
|
protected DbSyncService syncDataService { get; set; }
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Private Fields
|
|
|
|
/// <summary>
|
|
/// Classe per logging
|
|
/// </summary>
|
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |