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 @@