diff --git a/Controllers/ClientiController.cs b/Controllers/ClientiController.cs index 4e50431..db46681 100644 --- a/Controllers/ClientiController.cs +++ b/Controllers/ClientiController.cs @@ -15,10 +15,10 @@ namespace ApiSoftway.Controllers private readonly ILogger _logger; private readonly IConfiguration? _configuration; - public ClientiController(GESA_CLIENTI_DbContext dbClientiContext, DbSet clienti, ILogger logger, IConfiguration? configuration) + public ClientiController(GESA_CLIENTI_DbContext dbClientiContext, ILogger logger, IConfiguration? configuration) { _dbClientiContext = dbClientiContext; - _clienti = clienti; + _logger = logger; _configuration = configuration; } @@ -28,7 +28,7 @@ namespace ApiSoftway.Controllers { List listClienti = new List(); //Clienti cliente = new Clienti(); - _clienti = _dbClientiContext.Clienti; + _clienti = _dbClientiContext.Cli; var lista = await _clienti.ToListAsync(); foreach (var client in lista) diff --git a/Models/Clienti.cs b/Models/Clienti.cs index b66b193..e549488 100644 --- a/Models/Clienti.cs +++ b/Models/Clienti.cs @@ -1,5 +1,8 @@ -namespace ApiSoftway.Models +using Microsoft.EntityFrameworkCore; + +namespace ApiSoftway.Models { + [Keyless] public class Clienti { public string? antipcon { get; set; } diff --git a/Models/Gesa_DbContext/GESA_CLIENTI_DbContext.cs b/Models/Gesa_DbContext/GESA_CLIENTI_DbContext.cs index c59fe1f..c5ab116 100644 --- a/Models/Gesa_DbContext/GESA_CLIENTI_DbContext.cs +++ b/Models/Gesa_DbContext/GESA_CLIENTI_DbContext.cs @@ -4,15 +4,13 @@ namespace ApiSoftway.Models.Gesa_DbContext { public class GESA_CLIENTI_DbContext : DbContext { - public DbSet Clienti { get; set; } - - public GESA_CLIENTI_DbContext(DbContextOptions options) : base (options) + public DbSet? Cli { get; set; } + public GESA_CLIENTI_DbContext(DbContextOptions options) : base(options) { - } protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity().ToView("API_CLIENTI"); + modelBuilder.Entity().ToView("API_PERSONALE"); } }