lista giri da creare

This commit is contained in:
Marco Audiffredi 2024-06-28 10:06:49 +02:00
parent 5443d5ff65
commit f45ef8b810
3 changed files with 61 additions and 3 deletions

View File

@ -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<GiriConsegnaDaCreare> getNuoviGiri()
{
SessionHelper helper = new SessionHelper(this);
List<GiriConsegnaDaCreare> modelList = new List<GiriConsegnaDaCreare> ();
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<List<GiriConsegnaDaCreare>>(data);
}
return modelList;
}
}
}

View File

@ -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; }
}
}

View File

@ -6,7 +6,7 @@
<div class="agy-project-wrapper agy-project-page-wrapper">
<div class="container">
<div class="row">
<div class="row">
@* <div class="row">
<div class="col-md-8">
<form asp-action="Create">
@ -46,9 +46,31 @@
@Html.HiddenFor(x => x.DataChiusura)
</form>
</div>
</div>*@
<div class="row">
<div class="col-md-8">
<table class="table">
<thead>
<tr>
<th>Data</th>
<th>Autista</th>
<th>Automezzo</th>
</tr>
</thead>
<tbody>
@foreach (var person in ViewBag.NuoviGiri)
{
<tr>
<td>@person.DataGiro.ToString("dd/MM/yyyy")</td>
<td>@person.CodAutista - @person.Autista</td>
<td>@person.CodAutomezzo - @person.Automezzo</td>
</tr>
}
</tbody>
</table>
</div>
</div>
@section Scripts {
@{
await Html.RenderPartialAsync("_ValidationScriptsPartial");