Debug: Add logging to Categories Edit POST action
Added console logging to track: - Received values (Name, Description, IsActive) - IsActive.HasValue check - ModelState validation errors This will help diagnose the checkbox binding issue. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
33cd7bddbc
commit
261c3e0580
@ -70,8 +70,18 @@ public class CategoriesController : Controller
|
|||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(Guid id, UpdateCategoryDto model)
|
public async Task<IActionResult> Edit(Guid id, UpdateCategoryDto model)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Edit POST - CategoryId: {id}");
|
||||||
|
Console.WriteLine($"Edit POST - Name: '{model?.Name}'");
|
||||||
|
Console.WriteLine($"Edit POST - Description: '{model?.Description}'");
|
||||||
|
Console.WriteLine($"Edit POST - IsActive: {model?.IsActive} (HasValue: {model?.IsActive.HasValue})");
|
||||||
|
Console.WriteLine($"ModelState.IsValid: {ModelState.IsValid}");
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
|
foreach (var error in ModelState)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"ModelState Error - Key: {error.Key}, Errors: {string.Join(", ", error.Value.Errors.Select(e => e.ErrorMessage))}");
|
||||||
|
}
|
||||||
ViewData["CategoryId"] = id;
|
ViewData["CategoryId"] = id;
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user