From f8dc00e4ad0fad18a4e09f3a63bc9c2633ce4369 Mon Sep 17 00:00:00 2001 From: lidiami8 Date: Sun, 23 Apr 2023 17:59:08 +0200 Subject: [PATCH 1/3] creo modello menu nel folder Models --- Models/Menu.cs | 28 ++++++++++++++++++++++++++++ dotnet-rpg.sln | 25 +++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 Models/Menu.cs create mode 100644 dotnet-rpg.sln diff --git a/Models/Menu.cs b/Models/Menu.cs new file mode 100644 index 0000000..702e62b --- /dev/null +++ b/Models/Menu.cs @@ -0,0 +1,28 @@ +namespace dotnet_rpg.Models +{ + public class Menu + { + public int Id { get; set; } + public string AppName { get; set; } + public string Logo { get; set; } + public List dbnames { get; set; } + public string Language { get; set; } + public string FullName { get; set; } + public partial class parmItem + { + public string cod_APPL { get; set; } + + public string APP_NAME { get; set; } + } + public partial class MenuItem + { + public int id { get; set; } + public object? ParentID { get; set; } + public string Title { get; set; } + public string Url { get; set; } + + } + + + } +} diff --git a/dotnet-rpg.sln b/dotnet-rpg.sln new file mode 100644 index 0000000..a2cb3b3 --- /dev/null +++ b/dotnet-rpg.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-rpg", "dotnet-rpg.csproj", "{E65900E6-6838-49BC-B65A-E3CACC524524}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E65900E6-6838-49BC-B65A-E3CACC524524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E65900E6-6838-49BC-B65A-E3CACC524524}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E65900E6-6838-49BC-B65A-E3CACC524524}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E65900E6-6838-49BC-B65A-E3CACC524524}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A6EE36CF-B917-47BB-91EE-C42A36833870} + EndGlobalSection +EndGlobal From b87c963f647d1abb094072ae15e4b4d1ab83de77 Mon Sep 17 00:00:00 2001 From: lidiami8 Date: Mon, 24 Apr 2023 07:04:55 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Ho=20dovuto=20commentare=20la=20classe=20me?= =?UTF-8?q?nu.cs=20perch=C3=A8=20non=20funziona=20enum=20DbNames=20(analog?= =?UTF-8?q?o=20di=20RpgClass=20di=20Character)=20e=20poi=20non=20so=20come?= =?UTF-8?q?=20gestire=20le=20classi=20parziale=20del=20modello=20PFNG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Models/DbNames.cs | 11 +++++++++++ Models/Menu.cs | 45 +++++++++++++++++++++++---------------------- 2 files changed, 34 insertions(+), 22 deletions(-) create mode 100644 Models/DbNames.cs diff --git a/Models/DbNames.cs b/Models/DbNames.cs new file mode 100644 index 0000000..bc4fcf6 --- /dev/null +++ b/Models/DbNames.cs @@ -0,0 +1,11 @@ +using System.Text.Json.Serialization; +namespace dotnet_rpg.Models +{ + [JsonConverter(typeof(JsonStringEnumConverter))] + public enum DbNames + { + ISO9000 = 1, + RiskManagement = 2, + Grc = 3 + } +} diff --git a/Models/Menu.cs b/Models/Menu.cs index 702e62b..f2002e8 100644 --- a/Models/Menu.cs +++ b/Models/Menu.cs @@ -1,28 +1,29 @@ -namespace dotnet_rpg.Models +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +namespace dotnet_rpg.Models { public class Menu { public int Id { get; set; } - public string AppName { get; set; } - public string Logo { get; set; } - public List dbnames { get; set; } - public string Language { get; set; } - public string FullName { get; set; } - public partial class parmItem - { - public string cod_APPL { get; set; } + public string AppName { get; set; } = "nomedellapp"; + public string Logo { get; set; } = "stringalogo"; + //public List? Dbnames { get; set; } + // public DbNames class { get; set; } = DbNames.Grc; + // public string? Language { get; set; } + //public string? FullName { get; set; } + //public partial class ParmItem + //{ + // public string? Cod_APPL { get; set; } - public string APP_NAME { get; set; } - } - public partial class MenuItem - { - public int id { get; set; } - public object? ParentID { get; set; } - public string Title { get; set; } - public string Url { get; set; } + // public string? APP_NAME { get; set; } + //} + //public partial class MenuItem + //{ + // public int Id { get; set; } + // public object? ParentID { get; set; } + // public string? Title { get; set; } + // public string? Url { get; set; } - } - - - } -} + }} From e89c48977ba853984162f3b0a6641e751a043634 Mon Sep 17 00:00:00 2001 From: lidiami8 Date: Mon, 24 Apr 2023 09:22:18 +0200 Subject: [PATCH 3/3] Creato il controller per il menu semplificato, solo id, AppName Logo (stringa) --- Controllers/MenuController.cs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Controllers/MenuController.cs diff --git a/Controllers/MenuController.cs b/Controllers/MenuController.cs new file mode 100644 index 0000000..54354b0 --- /dev/null +++ b/Controllers/MenuController.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +using Microsoft.AspNetCore.Mvc; + + +namespace dotnet_rpg.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class MenuController : Controller + { + private static List menus = new List//è mock!! + { + new Menu (), + new Menu {Id=1, AppName="nuovaAppname"} + }; + [HttpGet("GetuttiMenu")] + public ActionResult> Get() + { + return Ok(menus); + } + + [HttpGet("{id}")] + public ActionResult GetSingle(int id) + { + return Ok(menus.FirstOrDefault(c => c.Id == id)); + } + } +}