From 6aea1bff53dc64bc9568cc8ded2e15620fb9bb2b Mon Sep 17 00:00:00 2001
From: Adam Hopkins <127156771+simpat-adam@users.noreply.github.com>
Date: Tue, 12 Dec 2023 14:08:56 -0600
Subject: [PATCH] [DI-1132] Prevent editing IsDeleteOperation after save (#49)
* Prevent editing IsDeleteOperation after save
* Hidden input for IsDeleteOperation on edit
* Remove hidden input with duplicate Id
* Fix jquery
---
.../Features/DataMaps/AddEdit.cshtml | 27 +++++++++++++++----
.../Infrastructure/HtmlHelperExtensions.cs | 11 ++++++--
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/DataImport.Web/Features/DataMaps/AddEdit.cshtml b/DataImport.Web/Features/DataMaps/AddEdit.cshtml
index c7d27218..1d7a8548 100644
--- a/DataImport.Web/Features/DataMaps/AddEdit.cshtml
+++ b/DataImport.Web/Features/DataMaps/AddEdit.cshtml
@@ -104,7 +104,8 @@ See the LICENSE and NOTICES files in the project root for more information.
@Html.HiddenFor(m => m.ApiVersionId)
@Html.Display(m => m.ApiVersion)
@Html.Display(m => m.ResourceName)
- @Html.HiddenFor(m => m.ResourcePath)
+ @Html.HiddenFor(m => m.ResourcePath)
+ @Html.HiddenFor(m => m.IsDeleteOperation)
}
@@ -127,7 +128,18 @@ See the LICENSE and NOTICES files in the project root for more information.
- @Html.Input(m => m.IsDeleteOperation)
+ if (ControllerAction(Context.Request.RouteValues) == "Add" || Model.IsDeleteOperation)
+ {
+ @Html.Input(m => m.IsDeleteOperation, ControllerAction(Context.Request.RouteValues) == "Edit")
+ }
+ else
+ {
+
+ }