Compare commits

..

No commits in common. "eebed847bc2a00545b8d1b2a0eb8153e3745d30e" and "2a04d7f52c0b23a49133a0cc22ea163e10e7b43f" have entirely different histories.

7 changed files with 26 additions and 123 deletions

View File

@ -1,29 +0,0 @@
using ApiAdHoc_Odoo.Data;
using ApiAdHoc_Odoo.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace ApiAdHoc_Odoo.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ArticoliController : ControllerBase
{
private readonly PiDbContext _articoliContext;
public ArticoliController(PiDbContext articoliContext)
{
_articoliContext = articoliContext;
}
[HttpGet]
public async Task<ActionResult<IEnumerable<Articolo>>> GetApiArticoli()
{
var articoliList = _articoliContext.Articolo.ToListAsync();
return await articoliList;
}
}
}

View File

@ -1,29 +0,0 @@
using ApiAdHoc_Odoo.Data;
using ApiAdHoc_Odoo.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace ApiAdHoc_Odoo.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ScadenzeController : ControllerBase
{
private readonly PiDbContext _scadenzeContext;
public ScadenzeController(PiDbContext scadenzeContext)
{
_scadenzeContext = scadenzeContext;
}
[HttpGet("{codAzi}/{codCli}")]
public async Task<ActionResult<IEnumerable<Scadenze>>> GetApiScadenze(string codAzi, string codCli)
{
var scadenzeList = _scadenzeContext.Scadenza.
Where(x => x.Azienda == codAzi && x.Cliente == codCli).OrderBy(x => x.Scadenza).ToListAsync();
return await scadenzeList;
}
}
}

View File

@ -10,28 +10,18 @@ namespace ApiAdHoc_Odoo.Data
public DbSet<Cliente> Clienti { get; set; } public DbSet<Cliente> Clienti { get; set; }
public DbSet<Fattura> Fattura { get; set; } public DbSet<Fattura> Fattura { get; set; }
public DbSet<Scadenze> Scadenza { get; set; }
public DbSet<Articolo> Articolo { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
// Map the view to the model // Map the view to the model
modelBuilder.Entity<Cliente>() modelBuilder.Entity<Cliente>()
.ToView("PI_APICLIENTI") .ToView("PI_APICLIENTI")/*;*/
.HasNoKey(); // Views typically don't have a primary key .HasNoKey(); // Views typically don't have a primary key
// Map the view to the model // Map the view to the model
modelBuilder.Entity<Fattura>() modelBuilder.Entity<Fattura>()
.ToView("PI_APIFATTURE") .ToView("PI_APIFATTURE")/*;*/
.HasNoKey(); // Views typically don't have a primary key .HasNoKey(); // Views typically don't have a primary key
// Map the view to the model
modelBuilder.Entity<Scadenze>()
.ToView("PI_APISCADENZE2")
.HasNoKey(); // Views typically don't have a primary key
// Map the view to the model
modelBuilder.Entity<Articolo>()
.ToView("PI_APIARTICOLI")
.HasNoKey(); // Views typically don't have a primary key
} }
} }
} }

View File

@ -1,10 +0,0 @@
namespace ApiAdHoc_Odoo.Models
{
public class Articolo
{
//public string? Azienda { get; set; }
public string? CodArticolo { get; set; }
public string? Descrizione { get; set; }
public string? DescriSupplementare { get; set; }
}
}

View File

@ -4,21 +4,21 @@ namespace ApiAdHoc_Odoo.Models
{ {
public class Cliente public class Cliente
{ {
public string? Azienda { get; set; } public string Azienda { get; set; }
public string? Codice { get; set; } public string Codice { get; set; }
public string? Descrizione { get; set; } public string Descrizione { get; set; }
public string? Partiva { get; set; } public string Partiva { get; set; }
public string? CodFisc { get; set; } public string CodFisc { get; set; }
public string? Telefono { get; set; } public string Telefono { get; set; }
public string? Cellulare { get; set; } public string Cellulare { get; set; }
public string? Email { get; set; } public string Email { get; set; }
public string? Indirizzo { get; set; } public string Indirizzo { get; set; }
public string? Citta { get; set; } public string Citta { get; set; }
public string? Cap { get; set; } public string Cap { get; set; }
public string? Provincia { get; set; } public string Provincia { get; set; }
public string? CodAgente { get; set; } public string CodAgente { get; set; }
public string? DescriAgente { get; set; } public string DescriAgente { get; set; }
public int? Blocco { get; set; } public int Blocco { get; set; }
public DateTime? Obsolescenza { get; set; } public DateTime Obsolescenza { get; set; }
} }
} }

View File

@ -2,12 +2,12 @@
{ {
public class Fattura public class Fattura
{ {
public string? Azienda { get; set; } public string Azienda { get; set; }
public string? CodCliente { get; set; } public string CodCliente { get; set; }
public string? Descrizione { get; set; } public string Descrizione { get; set; }
public string? Classe { get; set; } public string Classe { get; set; }
public DateTime? DataDocumento { get; set; } public DateTime DataDocumento { get; set; }
public string? Documento { get; set; } public string Documento { get; set; }
public decimal? Totale { get; set; } public decimal Totale { get; set; }
} }
} }

View File

@ -1,19 +0,0 @@
namespace ApiAdHoc_Odoo.Models
{
public class Scadenze
{
public string? Azienda { get; set; }
public string? Partita { get; set; }
public DateTime? Scadenza { get; set; }
public string? Cliente { get; set; }
public string? Dare_Avere { get; set; }
public decimal/*string*/? Totale_Importo { get; set; }
public string? Modalita_Pagamento { get; set; }
public decimal/*string*/? Documento { get; set; }
public string? Alfa { get; set; }
public DateTime? Data_Documento { get; set; }
public string? Seriale_Partita { get; set; }
public DateTime? Apertura { get; set; }
public string? Flag_Cr_Sa { get; set; }
}
}