diff --git a/Controllers/ChiusureController.cs b/Controllers/ChiusureController.cs index c8b1116..760b3d9 100644 --- a/Controllers/ChiusureController.cs +++ b/Controllers/ChiusureController.cs @@ -285,6 +285,5 @@ namespace VirtualTask.Controllers } #endregion DELETE - } } diff --git a/Controllers/ImpiantiController.cs b/Controllers/ImpiantiController.cs index fcad09f..14b553a 100644 --- a/Controllers/ImpiantiController.cs +++ b/Controllers/ImpiantiController.cs @@ -85,7 +85,6 @@ namespace VirtualTask.Controllers urlBase = urlBase + "?token=" + token; Uri baseAddress = new Uri(urlBase); client.BaseAddress = baseAddress; - string data = JsonConvert.SerializeObject(model); StringContent content = new StringContent(data, Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(baseAddress, content).Result; diff --git a/Controllers/Rapp_NewController.cs b/Controllers/Rapp_NewController.cs index b5d4b0f..21e7ef8 100644 --- a/Controllers/Rapp_NewController.cs +++ b/Controllers/Rapp_NewController.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; using Newtonsoft.Json; using System.Text; using VirtualTask.Models; @@ -16,7 +17,7 @@ namespace VirtualTask.Controllers public Rapp_NewController() { - + client = new HttpClient(); } #region INDEX @@ -72,21 +73,51 @@ namespace VirtualTask.Controllers public IActionResult Create() { + ViewBag.AllStockList = LoadStockitems(); return View(); } + //metodo per avere riempire combobox con la tabella delle chiusure + private List LoadStockitems() + { + SessionHelper helper = new SessionHelper(this); + token = helper.GetStringValue("tok"); + apiUrl = helper.GetStringValue("apiUrl"); + urlBase = apiUrl + "codici_chiusura"; + urlBase = urlBase + "?token=" + token; + Uri baseAddress = new Uri(urlBase); + client = new HttpClient(); + client.BaseAddress = baseAddress; + List selectItems = new List(); + List modelList = new List(); + HttpResponseMessage response = client.GetAsync(baseAddress).Result; + if (response.IsSuccessStatusCode) + { + string data = response.Content.ReadAsStringAsync().Result; + modelList = JsonConvert.DeserializeObject>(data); + foreach (var role in modelList) + { + SelectListItem listItem = new SelectListItem(); + listItem.Value = role.cccodice; + listItem.Text = role.ccdescr; + selectItems.Add(listItem); + } + } + return selectItems; + } + [HttpPost] public IActionResult Create(Rapp_New model) { SessionHelper helper = new SessionHelper(this); - token = helper.GetStringValue("tok"); + if (string.IsNullOrEmpty(token)) + return RedirectToAction("Index", "Login"); apiUrl = helper.GetStringValue("apiUrl"); urlBase = apiUrl + "rappnew/add"; urlBase = urlBase + "?token=" + token; Uri baseAddress = new Uri(urlBase); - client = new HttpClient(); client.BaseAddress = baseAddress; string data = JsonConvert.SerializeObject(model); @@ -237,7 +268,7 @@ namespace VirtualTask.Controllers token = helper.GetStringValue("tok"); apiUrl = helper.GetStringValue("apiUrl"); - urlBase = apiUrl + "rappnew/del?" + "codice=" + id + "&"; + urlBase = apiUrl + "rappnew/del?" + "serialeRapportino=" + id + "&"; urlBase = urlBase + "token=" + token; Uri baseAddress = new Uri(urlBase); client = new HttpClient(); diff --git a/Views/Rapp_New/Create.cshtml b/Views/Rapp_New/Create.cshtml index d33a52f..d4d48f9 100644 --- a/Views/Rapp_New/Create.cshtml +++ b/Views/Rapp_New/Create.cshtml @@ -74,52 +74,72 @@
- + @* *@ + @Html.DropDownListFor(x => x.codice_chiusura_1, + (IEnumerable)ViewBag.AllStockList)
- + @* *@ + @Html.DropDownListFor(x => x.codice_chiusura_2, + (IEnumerable)ViewBag.AllStockList)
- + @* *@ + @Html.DropDownListFor(x => x.codice_chiusura_3, + (IEnumerable)ViewBag.AllStockList)
- + @* *@ + @Html.DropDownListFor(x => x.codice_chiusura_4, + (IEnumerable)ViewBag.AllStockList)
- + @* *@ + @Html.DropDownListFor(x => x.codice_chiusura_5, + (IEnumerable)ViewBag.AllStockList)
- + @* *@ + @Html.DropDownListFor(x => x.codice_chiusura_6, + (IEnumerable)ViewBag.AllStockList)
- + @* *@ + @Html.DropDownListFor(x => x.codice_chiusura_7, + (IEnumerable)ViewBag.AllStockList)
- + @* *@ + @Html.DropDownListFor(x => x.codice_chiusura_8, + (IEnumerable)ViewBag.AllStockList)
- + @* *@ + @Html.DropDownListFor(x => x.codice_chiusura_9, + (IEnumerable)ViewBag.AllStockList)
- + @* *@ + @Html.DropDownListFor(x => x.codice_chiusura_10, + (IEnumerable)ViewBag.AllStockList)
@@ -323,7 +343,21 @@
+ + + + + + + + + + diff --git a/Views/Rapp_New/Index.cshtml b/Views/Rapp_New/Index.cshtml index 58ce3cf..f74ae73 100644 --- a/Views/Rapp_New/Index.cshtml +++ b/Views/Rapp_New/Index.cshtml @@ -75,7 +75,7 @@ @* @Html.DisplayNameFor(model => model.min_fin_rapportino) *@ MINUTO FINE - + @* @Html.DisplayNameFor(model => model.codice_chiusura_1) *@ CODICE CHIUSURA 1 @@ -313,7 +313,7 @@ @Html.DisplayFor(modelItem => item.min_fin_rapportino) - + @Html.DisplayFor(modelItem => item.codice_chiusura_1)