97 lines
2.7 KiB
C#
97 lines
2.7 KiB
C#
using DnsClient.Protocol;
|
|
using Microsoft.Data.SqlClient;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using MP.Data.DbModels;
|
|
using NLog;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing.Drawing2D;
|
|
using System.Linq;
|
|
using static MP.Core.Objects.Enums;
|
|
|
|
namespace MP.Data.Controllers
|
|
{
|
|
public class MpVocController : IDisposable
|
|
{
|
|
#region Public Constructors
|
|
|
|
public MpVocController(IConfiguration configuration)
|
|
{
|
|
_configuration = configuration;
|
|
Log.Info("Avviata classe MpVocController");
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// Elenco da tabella Config
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<ConfigModel> ConfigGetAll()
|
|
{
|
|
List<ConfigModel> dbResult = new List<ConfigModel>();
|
|
using (var dbCtx = new MoonPro_VocContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetConfig
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.Chiave)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco Lingue
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<LingueModel> LingueGetAll()
|
|
{
|
|
List<LingueModel> dbResult = new List<LingueModel>();
|
|
using (var dbCtx = new MoonPro_VocContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetLilngue
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.Lingua)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco Vocabolario (completo)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<VocabolarioModel> VocabolarioGetAll()
|
|
{
|
|
List<VocabolarioModel> dbResult = new List<VocabolarioModel>();
|
|
using (var dbCtx = new MoonPro_VocContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetVocabolario
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.Lemma)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Private Fields
|
|
|
|
private static IConfiguration _configuration;
|
|
|
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |