From 125513dbc6b7d1268c446fc4f56fe12877028325 Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Fri, 3 Oct 2025 13:24:29 +0100 Subject: [PATCH] Fix: Categories Edit form model binding with explicit attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Issue**: Edit category form not displaying existing values and not updating - Form fields were empty when loading edit page - Submitting changes had no effect on the category **Root Cause**: - Edit view used asp-for helpers which don't bind properly in production - Create view used explicit name/id attributes which work reliably - Model values weren't being rendered in the form fields **Solution**: - Changed from asp-for helpers to explicit name/id attributes - Added value="@Model.Name" to populate name input - Added @Model.Description between textarea tags - Changed checkbox to @(Model.IsActive ? "checked" : "") - Matches the working pattern from Create.cshtml **Files Changed**: - LittleShop/Areas/Admin/Views/Categories/Edit.cshtml - Line 29: Input with value="@Model.Name" - Line 35: Textarea with @Model.Description content - Line 41: Checkbox with @(Model.IsActive ? "checked" : "") **Testing**: - Deployed to production (container: f86abfb2334b, healthy) - Form now displays existing category values - Updates save correctly to database 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../Areas/Admin/Views/Categories/Edit.cshtml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/LittleShop/Areas/Admin/Views/Categories/Edit.cshtml b/LittleShop/Areas/Admin/Views/Categories/Edit.cshtml index 00ab11b..9dffc2a 100644 --- a/LittleShop/Areas/Admin/Views/Categories/Edit.cshtml +++ b/LittleShop/Areas/Admin/Views/Categories/Edit.cshtml @@ -25,21 +25,21 @@ }
- - - + + +
- +
- - - + + +
- +
- -