From 9acb604a2b4e10d5ac4a983460eb7952e88c27d3 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli (WEB DEV)" Date: Wed, 5 Oct 2016 21:37:21 +0200 Subject: [PATCH] Update location con filtro mostra TUTTE le posizioni, poi permette di filtrare/selezionare... da completare restyle grafico e verifica partial da rendere hidden ("_") --- .../Controllers/LocationsController.cs | 17 +++++++- StockManMVC/StockManMVC.csproj | 1 + StockManMVC/Views/Locations/Index.cshtml | 41 +++--------------- .../Views/Locations/_ListByType.cshtml | 31 +++++++++++++ StockManMVC/bin/StockManMVC.dll | Bin 131584 -> 132096 bytes 5 files changed, 53 insertions(+), 37 deletions(-) create mode 100644 StockManMVC/Views/Locations/_ListByType.cshtml diff --git a/StockManMVC/Controllers/LocationsController.cs b/StockManMVC/Controllers/LocationsController.cs index e5a701c..fea57ec 100644 --- a/StockManMVC/Controllers/LocationsController.cs +++ b/StockManMVC/Controllers/LocationsController.cs @@ -18,12 +18,25 @@ namespace StockManMVC.Controllers public ActionResult Index(string LocTypeID) { if (LocTypeID == null) LocTypeID = ""; - ViewBag.SelLocType = LocTypeID; - ViewBag.LocType = new SelectList(db.LocType, "ID", "Descr", LocTypeID); + ViewBag.LocTypeID = new SelectList(db.LocType, "ID", "Descr", LocTypeID); var location = db.Location.Include(l => l.LocType); return View(location.ToList()); } + + // GET: Location/ListByType/LocTypeID + public ActionResult ListByType(string LocTypeID) + { + var CurrLocations = db.Location.Where(s => s.ID != ""); + if (LocTypeID.ToString() != "") + { + CurrLocations = db.Location.Where(s => s.LocTypeID == LocTypeID); + } + + ViewBag.LocTypeID = LocTypeID; + return PartialView("_ListByType", CurrLocations.ToList()); + } + // GET: Locations/Details/5 public ActionResult Details(string id) { diff --git a/StockManMVC/StockManMVC.csproj b/StockManMVC/StockManMVC.csproj index 927f02e..e8cb744 100644 --- a/StockManMVC/StockManMVC.csproj +++ b/StockManMVC/StockManMVC.csproj @@ -450,6 +450,7 @@ + Web.config diff --git a/StockManMVC/Views/Locations/Index.cshtml b/StockManMVC/Views/Locations/Index.cshtml index 1958a96..fd24365 100644 --- a/StockManMVC/Views/Locations/Index.cshtml +++ b/StockManMVC/Views/Locations/Index.cshtml @@ -13,7 +13,7 @@ Configurazione Posizioni
- @Html.DropDownList("LocType", null, "-- Selezionare --", htmlAttributes: new { @class = "form-control" }) + @Html.DropDownList("LocTypeID", null, "-- TUTTI --", htmlAttributes: new { @class = "form-control" })
@@ -22,36 +22,7 @@
- - - - - - - - @foreach (var item in Model) - { - var delStyle = ""; - if (item.ItemFlux.Count + item.ItemFlux1.Count > 0) { delStyle = "disabled invisible"; } - - - - - - } - -
- @Html.DisplayNameFor(model => model.Descr) - - @Html.DisplayNameFor(model => model.LocType.Descr) -
- @Html.DisplayFor(modelItem => item.Descr) - - @Html.DisplayFor(modelItem => item.LocType.Descr) - - - -
+ @Html.Partial("_ListByType")
@@ -65,14 +36,14 @@