inserimento nuovo giro e selezioa e deseleziona

This commit is contained in:
Marco Audiffredi 2024-07-09 10:28:37 +02:00
parent a93ecf22f7
commit 700dc5317e
4 changed files with 16 additions and 53 deletions

View File

@ -85,7 +85,9 @@ namespace SoftwayWeb.Controllers
}
}
public IActionResult Create()
public IActionResult Create(bool sel)
{
SessionHelper helper = new SessionHelper(this);
List<GiriConsegnaDaCreare> modelList = new List<GiriConsegnaDaCreare>();
@ -102,8 +104,12 @@ namespace SoftwayWeb.Controllers
string data = response.Content.ReadAsStringAsync().Result;
modelList = JsonConvert.DeserializeObject<List<GiriConsegnaDaCreare>>(data);
}
//ViewBag.Autisti = getAutisti();
//ViewBag.NuoviGiri = getNuoviGiri();
foreach(GiriConsegnaDaCreare giro in modelList)
{
giro.IsSelected= sel;
}
return View(modelList);
}

View File

@ -4,7 +4,7 @@ namespace SoftwayWeb.Models
{
public class GiriConsegnaDaCreare
{
public string? CodAutomezzo { get; set; }
public string? CodMezzo { get; set; }
public string? CodAutista { get; set; }
public string? Autista { get; set; }
public string? Automezzo { get; set; }

View File

@ -52,32 +52,7 @@
<div class="row">
<div class="col-md-8">
@* <table class="table">
<thead>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>Data</th>
<th>Autista</th>
<th>Automezzo</th>
</tr>
</thead>
<tbody>
@foreach (var person in ViewBag.NuoviGiri)
{
<tr>
<td>&nbsp;</td>
<td>@person.DataGiro.ToString("dd/MM/yyyy")</td>
<td>@person.CodAutista - @person.Autista</td>
<td>@person.CodAutomezzo - @person.Automezzo</td>
</tr>
}
</tbody>
</table>*@
@* @using (Html.BeginForm("PostIndex", "Giri", FormMethod.Post))
{*@
<form asp-action="PostIndex">
<table class="table">
<thead>
@ -107,8 +82,8 @@
</td>
<td>
@Html.DisplayFor(a=>lst[i].CodAutomezzo)-@Html.DisplayFor(a=>lst[i].Automezzo)
@Html.HiddenFor(a=>lst[i].CodAutomezzo)
@Html.DisplayFor(a=>lst[i].CodMezzo)-@Html.DisplayFor(a=>lst[i].Automezzo)
@Html.HiddenFor(a=>lst[i].CodMezzo)
</td>
@Html.HiddenFor(a=>lst[i].Automezzo)
@ -117,32 +92,14 @@
</tr>
}
@* @for (var i = 0; i < lst.Count(); i++)
{
string a = lst[i].CodAutista;
string d = lst[i].DataGiro.Value.ToString("dd/MM/yyyy");
string m = lst[i].CodAutomezzo;
<tr>
<td>
@Html.CheckBoxFor(m => [i].Selected);
</td>
<td>
@d
</td>
<td>
@a
</td>
<td>
@m
</td>
</tr>
}*@
</tbody>
</table>
<input type="submit" />
</form>
@Html.ActionLink("Seleziona tutti", "Create", "Giri",new { sel = true }, null)
&nbsp;
@Html.ActionLink("Deleziona tutti", "Create", "Giri",new { sel = false }, null)
</div>

View File

@ -95,7 +95,7 @@
@Html.DisplayFor(modelItem => item.CodAutista) - @Html.DisplayFor(modelItem => item.Autista)
</td>
<td>
@Html.HiddenFor(modelItem => item.CodMezzo) - @Html.HiddenFor(modelItem => item.Automezzo)
@Html.DisplayFor(modelItem => item.CodMezzo) - @Html.DisplayFor(modelItem => item.Automezzo)
</td>
<td>
@Html.DisplayFor(modelItem => item.BancaliCaricati)