Michele: Aggiunta combobox magazzini in Articoli
This commit is contained in:
parent
b0ddd70db6
commit
5ae0e94a65
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -81,6 +82,8 @@ namespace VirtualTask.Controllers
|
|||||||
.OrderByDescending(s => s.SlCodice)
|
.OrderByDescending(s => s.SlCodice)
|
||||||
.ToPagedList(page ?? 1, pageSize);
|
.ToPagedList(page ?? 1, pageSize);
|
||||||
|
|
||||||
|
ViewBag.Magazzini = MagazziniList();
|
||||||
|
|
||||||
return View(shortLinks);
|
return View(shortLinks);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -100,6 +103,8 @@ namespace VirtualTask.Controllers
|
|||||||
admin = helper.GetStringValue("admin");
|
admin = helper.GetStringValue("admin");
|
||||||
ViewBag.Admin = admin;
|
ViewBag.Admin = admin;
|
||||||
|
|
||||||
|
ViewBag.Magazzini = MagazziniList();
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,6 +227,7 @@ namespace VirtualTask.Controllers
|
|||||||
return RedirectToAction("Error");
|
return RedirectToAction("Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ViewBag.Magazzini = MagazziniList();
|
||||||
return View(ele);
|
return View(ele);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,6 +340,43 @@ namespace VirtualTask.Controllers
|
|||||||
|
|
||||||
#endregion DELETE
|
#endregion DELETE
|
||||||
|
|
||||||
|
private List<SelectListItem> MagazziniList()
|
||||||
|
{
|
||||||
|
SessionHelper helper = new SessionHelper(this);
|
||||||
|
token = helper.GetStringValue("tok");
|
||||||
|
apiUrl = helper.GetStringValue("apiUrl");
|
||||||
|
urlBase = apiUrl + "MagazziniVTList";
|
||||||
|
urlBase = urlBase + "?token=" + token;
|
||||||
|
Uri baseAddress = new Uri(urlBase);
|
||||||
|
client = new HttpClient();
|
||||||
|
client.BaseAddress = baseAddress;
|
||||||
|
List<SelectListItem> selectItems = new List<SelectListItem>();
|
||||||
|
List<MagazziniVT> modelList = new List<MagazziniVT>();
|
||||||
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
string data = response.Content.ReadAsStringAsync().Result;
|
||||||
|
modelList = JsonConvert.DeserializeObject<List<MagazziniVT>>(data);
|
||||||
|
modelList = modelList.Where(x => x.DataObso == null).ToList();
|
||||||
|
SelectListItem listItemFirst = new SelectListItem();
|
||||||
|
|
||||||
|
listItemFirst.Value = string.Empty;
|
||||||
|
listItemFirst.Text = "- Selezionare magazzino";
|
||||||
|
selectItems.Add(listItemFirst);
|
||||||
|
|
||||||
|
foreach (var role in modelList)
|
||||||
|
{
|
||||||
|
SelectListItem listItem = new SelectListItem();
|
||||||
|
|
||||||
|
listItem.Value = role.Mgcodmag;
|
||||||
|
listItem.Text = role.Mgcodmag + " - " + role.Mgdesmag;
|
||||||
|
selectItems.Add(listItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return selectItems;
|
||||||
|
}
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,8 +27,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<h5><label asp-for="SlCodMag" class="control-label"></label></h5>
|
<h5><label asp-for="SlCodMag" class="agy-client-quote"></label></h5>
|
||||||
<input asp-for="SlCodMag" class="form-control" />
|
@Html.DropDownListFor(x => x.SlCodMag, (IEnumerable<SelectListItem>)ViewBag.Magazzini, new { @class = "agy-form-field require" })
|
||||||
<span asp-validation-for="SlCodMag" class="text-danger"></span>
|
<span asp-validation-for="SlCodMag" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||||
|
|||||||
@ -24,10 +24,15 @@
|
|||||||
<span asp-validation-for="ArDesArt" class="text-danger"></span>
|
<span asp-validation-for="ArDesArt" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||||
<div class="form-group">
|
@* <div class="form-group">
|
||||||
<h5><label asp-for="SlCodMag" class="agy-client-quote"></label></h5>
|
<h5><label asp-for="SlCodMag" class="agy-client-quote"></label></h5>
|
||||||
<input asp-for="SlCodMag" class="agy-form-field require" class="form-control"/>
|
<input asp-for="SlCodMag" class="agy-form-field require" class="form-control"/>
|
||||||
<span asp-validation-for="SlCodMag" class="text-danger"></span>
|
<span asp-validation-for="SlCodMag" class="text-danger"></span>
|
||||||
|
</div> *@
|
||||||
|
<div class="form-group">
|
||||||
|
<h5><label asp-for="SlCodMag" class="agy-client-quote"></label></h5>
|
||||||
|
@Html.DropDownListFor(x => x.SlCodMag, (IEnumerable<SelectListItem>)ViewBag.Magazzini, new { @class = "agy-form-field require" })
|
||||||
|
<span asp-validation-for="SlCodMag" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user