diff --git a/StockManMVC/Controllers/ItemsController.cs b/StockManMVC/Controllers/ItemsController.cs index 6495ad7..77939c5 100644 --- a/StockManMVC/Controllers/ItemsController.cs +++ b/StockManMVC/Controllers/ItemsController.cs @@ -256,7 +256,6 @@ namespace StockManMVC.Controllers } - // GET: Items/Create public ActionResult Create() { @@ -332,9 +331,13 @@ namespace StockManMVC.Controllers db.Entry(item).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Details", "Items", new { ID = item.ID, StockItemID = item.ID, FluxItemID = item.ID }); + } + else + { + } ViewBag.ItemFamilyID = new SelectList(db.ItemFamily, "ID", "Descr", item.ItemFamilyID); - return View(item); + return View("Edit", item); } // GET: Items/Delete/5 diff --git a/StockManMVC/Models/Metadata.cs b/StockManMVC/Models/Metadata.cs index 9b2236e..810c1ec 100644 --- a/StockManMVC/Models/Metadata.cs +++ b/StockManMVC/Models/Metadata.cs @@ -129,4 +129,24 @@ namespace StockManMVC.Models [Display(Name = "Mov. aperti")] public String TotPend; } + + public class OperatorMetadata + { + [Display(Name = "ID interno")] + [Required] + public String ID; + + [Display(Name = "ID esterno")] + [Required] + public String CodExt; + + [Display(Name = "Cognome")] + [Required] + public String LastName; + + [Display(Name = "Nome")] + [Required] + public String FirstName; + + } } diff --git a/StockManMVC/Models/PartialClasses.cs b/StockManMVC/Models/PartialClasses.cs index 2cec4a9..32d5acb 100644 --- a/StockManMVC/Models/PartialClasses.cs +++ b/StockManMVC/Models/PartialClasses.cs @@ -39,4 +39,10 @@ namespace StockManMVC.Models public partial class ItemFamily { } + + + [MetadataType(typeof(OperatorMetadata))] + public partial class Operator + { + } } \ No newline at end of file diff --git a/StockManMVC/StockManMVC.csproj b/StockManMVC/StockManMVC.csproj index 1030318..7e48a6d 100644 --- a/StockManMVC/StockManMVC.csproj +++ b/StockManMVC/StockManMVC.csproj @@ -441,6 +441,7 @@ + diff --git a/StockManMVC/Views/Items/Edit.cshtml b/StockManMVC/Views/Items/Edit.cshtml new file mode 100644 index 0000000..a0bdb44 --- /dev/null +++ b/StockManMVC/Views/Items/Edit.cshtml @@ -0,0 +1,98 @@ +@model StockManMVC.Models.Item + +@{ + ViewBag.Title = "Edit"; +} + +

Edit

+@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + +
+

Articolo

+
+ @Html.ValidationSummary(true, "", new { @class = "text-danger" }) + @Html.HiddenFor(model => model.ID) + +
+ @Html.LabelFor(model => model.ItemFamily.Descr, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.DropDownList("ItemFamilyID", null, htmlAttributes: new { @class = "form-control" }) + @Html.ValidationMessageFor(model => model.ItemFamilyID, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.Descr, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.Descr, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Descr, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.CodInt, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.CodInt, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.CodInt, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.CodExt, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.CodExt, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.CodExt, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.DescrExt, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.DescrExt, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.DescrExt, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.QtaMin, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.QtaMin, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.QtaMin, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.QtaBatch, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.QtaBatch, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.QtaBatch, "", new { @class = "text-danger" }) +
+
+ +
+ @Html.LabelFor(model => model.CurrValue, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.CurrValue, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.CurrValue, "", new { @class = "text-danger" }) +
+
+ + +
+
+ +
+ +
+ +
+} + +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} + diff --git a/StockManMVC/Views/Items/_Edit.cshtml b/StockManMVC/Views/Items/_Edit.cshtml index 341e9fd..c966206 100644 --- a/StockManMVC/Views/Items/_Edit.cshtml +++ b/StockManMVC/Views/Items/_Edit.cshtml @@ -7,7 +7,7 @@ @using (Html.BeginForm()) { @Html.AntiForgeryToken() - +
@Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.ID) @@ -89,6 +89,17 @@
} + + + @section Scripts { @Scripts.Render("~/bundles/jqueryval") } diff --git a/StockManMVC/Views/Shared/_Layout.cshtml b/StockManMVC/Views/Shared/_Layout.cshtml index d7b52ac..94843e7 100644 --- a/StockManMVC/Views/Shared/_Layout.cshtml +++ b/StockManMVC/Views/Shared/_Layout.cshtml @@ -100,10 +100,12 @@ @Scripts.Render("~/bundles/bootstrap") *@ @RenderSection("scripts", required: false) diff --git a/StockManMVC/bin/StockManMVC.dll b/StockManMVC/bin/StockManMVC.dll index 6df58d1..d22af65 100644 Binary files a/StockManMVC/bin/StockManMVC.dll and b/StockManMVC/bin/StockManMVC.dll differ diff --git a/VersGen/bin/Debug/VersGen.dll b/VersGen/bin/Debug/VersGen.dll index 45b03bf..30334a9 100644 Binary files a/VersGen/bin/Debug/VersGen.dll and b/VersGen/bin/Debug/VersGen.dll differ diff --git a/VersGen/obj/Debug/VersGen.dll b/VersGen/obj/Debug/VersGen.dll index 45b03bf..30334a9 100644 Binary files a/VersGen/obj/Debug/VersGen.dll and b/VersGen/obj/Debug/VersGen.dll differ