diff --git a/Controllers/GiriController.cs b/Controllers/GiriController.cs index 73f4985..1a065bd 100644 --- a/Controllers/GiriController.cs +++ b/Controllers/GiriController.cs @@ -81,6 +81,7 @@ namespace SoftwayWeb.Controllers { SessionHelper helper = new SessionHelper(this); ViewBag.Autisti = getAutisti(); + ViewBag.NuoviGiri = getNuoviGiri(); return View(); } @@ -153,5 +154,25 @@ namespace SoftwayWeb.Controllers } return selectItems; } + + private List getNuoviGiri() + { + SessionHelper helper = new SessionHelper(this); + List modelList = new List (); + apiUrl = helper.GetStringValue("apiUrl"); + urlBase = apiUrl + "Giri/listaGiriDaCreare"; + + Uri baseAddress = new Uri(urlBase); + client = new HttpClient(); + client.BaseAddress = baseAddress; + + HttpResponseMessage response = client.GetAsync(baseAddress).Result; + if (response.IsSuccessStatusCode) + { + string data = response.Content.ReadAsStringAsync().Result; + modelList = JsonConvert.DeserializeObject>(data); + } + return modelList; + } } } diff --git a/Models/GiriConsegnaDaCreare.cs b/Models/GiriConsegnaDaCreare.cs new file mode 100644 index 0000000..2c38477 --- /dev/null +++ b/Models/GiriConsegnaDaCreare.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; + +namespace SoftwayWeb.Models +{ + public class GiriConsegnaDaCreare + { + public string? CodAutomezzo { get; set; } + public string? CodAutista { get; set; } + public string? Autista { get; set; } + public string? Automezzo { get; set; } + + [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")] + public DateTime? DataGiro { get; set; } + } +} diff --git a/Models/GiriConsegnaView.cs b/Models/GiriConsegnaView.cs index 00ba24a..4bef0f3 100644 --- a/Models/GiriConsegnaView.cs +++ b/Models/GiriConsegnaView.cs @@ -34,10 +34,7 @@ namespace SoftwayWeb.Models [Display(Name = "Data chiusura")] public DateTime? DataChiusura { get; set; } - [Display(Name = "Cod. Mezzo")] - public string? CodMezzo { get; set; } - - [Display(Name = "Automezzo")] + public string? CodMezzo { get; set; } public string? Automezzo { get; set; } } } diff --git a/Views/Giri/Create.cshtml b/Views/Giri/Create.cshtml index 3f73775..c154730 100644 --- a/Views/Giri/Create.cshtml +++ b/Views/Giri/Create.cshtml @@ -6,7 +6,7 @@
-
+@*
@@ -46,9 +46,31 @@ @Html.HiddenFor(x => x.DataChiusura)
+
*@ + +
+
+ + + + + + + + + + @foreach (var person in ViewBag.NuoviGiri) + { + + + + + + } + +
DataAutistaAutomezzo
@person.DataGiro.ToString("dd/MM/yyyy")@person.CodAutista - @person.Autista@person.CodAutomezzo - @person.Automezzo
+
- - @section Scripts { @{ await Html.RenderPartialAsync("_ValidationScriptsPartial");