diff --git a/Controllers/GiriController.cs b/Controllers/GiriController.cs index fb5b514..7f75714 100644 --- a/Controllers/GiriController.cs +++ b/Controllers/GiriController.cs @@ -223,6 +223,10 @@ namespace SoftwayWeb.Controllers [HttpPost] public IActionResult Bancali(GiriConsegnaView model) { + if (model.BancaliCaricati == null) + { + return View(model); + } SessionHelper helper = new SessionHelper(this); token = helper.GetStringValue("tok"); diff --git a/Models/GiriConsegnaView.cs b/Models/GiriConsegnaView.cs index ee7be90..5a7f3b3 100644 --- a/Models/GiriConsegnaView.cs +++ b/Models/GiriConsegnaView.cs @@ -17,7 +17,7 @@ namespace SoftwayWeb.Models [Display(Name = "Autista")] public string? Autista { get; set; } - [Display(Name = "Bancali caricati")] + [Display(Name = "Bancali caricati"), Required(ErrorMessage = "Inserire il numero di bancali")] public int? BancaliCaricati { get; set; } diff --git a/Views/Giri/Bancali.cshtml b/Views/Giri/Bancali.cshtml index 170ece5..656bddd 100644 --- a/Views/Giri/Bancali.cshtml +++ b/Views/Giri/Bancali.cshtml @@ -22,7 +22,7 @@
Inserire il numero di bancali
+ } *@ diff --git a/Views/Giri/Index.cshtml b/Views/Giri/Index.cshtml index 48abdea..877cf8e 100644 --- a/Views/Giri/Index.cshtml +++ b/Views/Giri/Index.cshtml @@ -80,80 +80,86 @@ - @foreach (var item in Model) + @foreach (var item in Model) { - string totBancaliCaricati = "-"; - if (item.BancaliCaricati!=null) + string totBancaliCaricati = "-"; + if (item.BancaliCaricati!=null) + { + totBancaliCaricati = Convert.ToString(item.BancaliCaricati.Value); + } +