From 0e376c070caa210d3e8cb8eb1305b7f6e5212d76 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 25 Jul 2022 07:56:20 +0200 Subject: [PATCH] Aggiunta lettura Link JQL --- MP.Data/Controllers/MpSpecController.cs | 25 ++++++++++++++++++ MP.Data/DatabaseModels/LinkMenuJQM.cs | 35 +++++++++++++++++++++++++ MP.Data/MoonProContext.cs | 20 +------------- 3 files changed, 61 insertions(+), 19 deletions(-) create mode 100644 MP.Data/DatabaseModels/LinkMenuJQM.cs diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 81d20728..5c68905b 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -79,6 +79,31 @@ namespace MP.Data.Controllers return ListValuesFilt("AnagArticoli", "Tipo"); } + + /// + /// Elenco valori link (x home e navMenu laterale) + /// + /// + public List ElencoLink() + { + return ListLinkFilt("SpecLink"); + } + + public List ListLinkFilt(string tipoLink) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetLinkMenu + .Where(x => x.TipoLink == tipoLink) + .AsNoTracking() + .OrderBy(x => x.ordine) + .ToList(); + } + return dbResult; + } + /// /// Eliminazione Record /// diff --git a/MP.Data/DatabaseModels/LinkMenuJQM.cs b/MP.Data/DatabaseModels/LinkMenuJQM.cs new file mode 100644 index 00000000..6f885057 --- /dev/null +++ b/MP.Data/DatabaseModels/LinkMenuJQM.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + [Table("LinkMenuJQM")] + public partial class LinkMenu + { + #region Public Properties + + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int idxLink { get; set; } + + [MaxLength(50)] + public string TipoLink { get; set; } = ""; + + public int ordine { get; set; } = 0; + + [MaxLength(50)] + public string Testo { get; set; } = ""; + + [MaxLength(50)] + public string NavigateUrl { get; set; } = ""; + + [MaxLength(50)] + public string icona { get; set; } = ""; + + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs index d695c05b..c477a8e9 100644 --- a/MP.Data/MoonProContext.cs +++ b/MP.Data/MoonProContext.cs @@ -41,6 +41,7 @@ namespace MP.Data public virtual DbSet DbSetConfig { get; set; } public virtual DbSet DbSetAnagGruppi { get; set; } public virtual DbSet DbSetListValues { get; set; } + public virtual DbSet DbSetLinkMenu { get; set; } #endregion Public Properties @@ -284,25 +285,6 @@ namespace MP.Data { entity.HasKey(e => new { e.TableName, e.FieldName, e.value}); - //entity.Property(e => e.TableName) - // .HasMaxLength(50) - // .HasColumnName("TableName"); - - //entity.Property(e => e.FieldName) - // .HasMaxLength(50) - // .HasColumnName("FieldName"); - - //entity.Property(e => e.value) - // .HasMaxLength(50) - // .HasColumnName("value"); - - //entity.Property(e => e.label) - // .HasMaxLength(50) - // .HasColumnName("label"); - - //entity.Property(e => e.ordinal) - // .HasColumnName("ordinal"); - }); OnModelCreatingPartial(modelBuilder);