90 lines
2.4 KiB
C#
90 lines
2.4 KiB
C#
using Liman.CadCam.DbModel;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using NLog;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Liman.CadCam.Controllers
|
|
{
|
|
public class CadCamController : IDisposable
|
|
{
|
|
#region Private Fields
|
|
|
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
|
private string connString = "";
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Public Constructors
|
|
|
|
public CadCamController()
|
|
{
|
|
// imposto la connstring...
|
|
connString = DbConfig.CONNECTION_STRING;
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
// Clear database context
|
|
Log.Info("Dispose di CadCamController");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco Chiavi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<KeyModel> KeysGetAll()
|
|
{
|
|
List<KeyModel> dbResult = new List<KeyModel>();
|
|
using (LicManMdbContext dbCtx = new LicManMdbContext(connString))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetKeys
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco Licenze
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<LicenceModel> LicensesGetAll()
|
|
{
|
|
List<LicenceModel> dbResult = new List<LicenceModel>();
|
|
using (LicManMdbContext dbCtx = new LicManMdbContext(connString))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetLicences
|
|
.Include(p => p.ProdNav)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco Products
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<ProductModel> ProductsGetAll()
|
|
{
|
|
List<ProductModel> dbResult = new List<ProductModel>();
|
|
using (LicManMdbContext dbCtx = new LicManMdbContext(connString))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetProducts
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |