diff --git a/Controllers/ImpiantiController.cs b/Controllers/ImpiantiController.cs index 14b553a..1b6fa31 100644 --- a/Controllers/ImpiantiController.cs +++ b/Controllers/ImpiantiController.cs @@ -14,6 +14,7 @@ namespace VirtualTask.Controllers string apiUrl = string.Empty; string urlBase = string.Empty; string token = string.Empty; + string tenant = string.Empty; HttpClient client; public ImpiantiController() @@ -25,6 +26,7 @@ namespace VirtualTask.Controllers { SessionHelper helper = new SessionHelper(this); token = helper.GetStringValue("tok"); + if (string.IsNullOrEmpty(token)) return RedirectToAction("Index", "Login"); @@ -77,9 +79,10 @@ namespace VirtualTask.Controllers { SessionHelper helper = new SessionHelper(this); token = helper.GetStringValue("tok"); + tenant = helper.GetStringValue("tenant"); if (string.IsNullOrEmpty(token)) return RedirectToAction("Index", "Login"); - + model.imcodazi = tenant; apiUrl = helper.GetStringValue("apiUrl"); urlBase = apiUrl + "impianti/add"; urlBase = urlBase + "?token=" + token; diff --git a/Controllers/LoginController.cs b/Controllers/LoginController.cs index 3974891..4f655d1 100644 --- a/Controllers/LoginController.cs +++ b/Controllers/LoginController.cs @@ -49,6 +49,7 @@ namespace VirtualTask.Controllers //ViewBag.Token = loginOut.Tok; helper.SetStringValue("tok", loginOut.Tok); helper.SetStringValue("apiUrl", apiUrl); + helper.SetStringValue("tenant", model.Tenant); return RedirectToAction("Index","Home"); } return View(); diff --git a/Models/Impianto.cs b/Models/Impianto.cs index 49a4314..e043852 100644 --- a/Models/Impianto.cs +++ b/Models/Impianto.cs @@ -18,30 +18,39 @@ namespace VirtualTask.Models public string? imdescri { get; set; } /// Tipo indirizzo (Via, piazza..) + [Display(Name = "Via,piazza,..")] public string? imindiri1 { get; set; } /// indirizzo + [Display(Name = "Indirizzo")] public string? imindiri2 { get; set; } /// numero civico + [Display(Name = "Num civico")] public int? imindiri3 { get; set; } /// sottonumero + [Display(Name = "Interno")] public string? imindiri4 { get; set; } /// scala + [Display(Name = "Scala")] public string? imindiri5 { get; set; } /// localita + [Display(Name = "Località")] public string? imlocali { get; set; } /// Cap + [Display(Name = "Cap")] public string? imcodcap { get; set; } /// Comune + [Display(Name = "Comune")] public string? imcomune { get; set; } /// Provincia + [Display(Name = "Provincia")] public string? improvin { get; set; } [Display(Name = "Cliente")] diff --git a/Views/Impianti/Create.cshtml b/Views/Impianti/Create.cshtml index ae5da8c..0170b14 100644 --- a/Views/Impianti/Create.cshtml +++ b/Views/Impianti/Create.cshtml @@ -17,11 +17,12 @@ -
+@*
-
+
*@ + @Html.HiddenFor(m => m.imcodazi)
@@ -74,19 +75,11 @@
- @Html.DropDownListFor(x =>x.imultcli, - (IEnumerable)ViewBag.AllStockList) - - + @Html.DropDownListFor(x =>x.imultcli,(IEnumerable)ViewBag.AllStockList,new {@class = "form-control"})
-
- @Html.LabelFor(model => model.imultcli, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.DropDownListFor(c => c.imultcli, (IEnumerable)ViewBag.AllStockList, null, new { @class = "selectpicker", data_live_search = "true" }) -
-
+