96 lines
2.6 KiB
C#
96 lines
2.6 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using MP.AppAuth.Models;
|
|
using NLog;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace MP.AppAuth.Controllers
|
|
{
|
|
public class MPController : IDisposable
|
|
{
|
|
#region Public Fields
|
|
|
|
public static MPController dbController;
|
|
|
|
#endregion Public Fields
|
|
|
|
#region Public Constructors
|
|
|
|
public MPController(IConfiguration configuration)
|
|
{
|
|
_configuration = configuration;
|
|
Log.Info("Avviata classe MpController");
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// Elenco Record x AnagKeyValue
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<AnagKeyValueModel> AnagKeyValuesGetAll()
|
|
{
|
|
List<AnagKeyValueModel> dbResult = new List<AnagKeyValueModel>();
|
|
using (MoonProContext localDbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = localDbCtx
|
|
.DbSetAnagKeyValues
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco Record x Config
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<ConfigModel> ConfigGetAll()
|
|
{
|
|
List<ConfigModel> dbResult = new List<ConfigModel>();
|
|
using (MoonProContext localDbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = localDbCtx
|
|
.DbSetConfig
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (dbController != null)
|
|
{
|
|
// Clear database controller
|
|
dbController.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco Record x Vocabolario
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<Vocabolario> VocabolarioGetAll()
|
|
{
|
|
List<Vocabolario> dbResult = new List<Vocabolario>();
|
|
using (MoonProContext localDbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = localDbCtx
|
|
.DbSetVocabolario
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Private Fields
|
|
|
|
private static IConfiguration _configuration;
|
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |