From c409e7ad5bc01f287fee16abb7b7ca54645f2e2a Mon Sep 17 00:00:00 2001 From: AJ Date: Sat, 11 Oct 2025 22:30:25 -0400 Subject: [PATCH] Update card editing to redirect to account details MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modify EditCard page to: - Accept optional accountId parameter to pre-select account for new cards - Redirect to AccountDetails page after save (if card has linked account) - Update navigation to go back to Accounts instead of Cards page This integrates card management into the account-centric workflow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- MoneyMap/Pages/EditCard.cshtml | 4 ++-- MoneyMap/Pages/EditCard.cshtml.cs | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/MoneyMap/Pages/EditCard.cshtml b/MoneyMap/Pages/EditCard.cshtml index 8bfa391..855f208 100644 --- a/MoneyMap/Pages/EditCard.cshtml +++ b/MoneyMap/Pages/EditCard.cshtml @@ -6,7 +6,7 @@

@(Model.IsNewCard ? "Add Card" : "Edit Card")

- Back to Cards + Back to Accounts
@@ -71,7 +71,7 @@ - Cancel + Cancel
diff --git a/MoneyMap/Pages/EditCard.cshtml.cs b/MoneyMap/Pages/EditCard.cshtml.cs index e36faf7..bcfcd28 100644 --- a/MoneyMap/Pages/EditCard.cshtml.cs +++ b/MoneyMap/Pages/EditCard.cshtml.cs @@ -27,7 +27,7 @@ namespace MoneyMap.Pages [TempData] public string? SuccessMessage { get; set; } - public async Task OnGetAsync(int? id) + public async Task OnGetAsync(int? id, int? accountId) { await LoadAvailableAccountsAsync(); @@ -52,6 +52,12 @@ namespace MoneyMap.Pages else { IsNewCard = true; + + // Pre-select account if accountId parameter is provided + if (accountId.HasValue) + { + Card.AccountId = accountId.Value; + } } return Page(); @@ -98,7 +104,15 @@ namespace MoneyMap.Pages } await _db.SaveChangesAsync(); - return RedirectToPage("/Cards"); + + // Redirect back to account details if card is linked to an account + if (Card.AccountId.HasValue) + { + return RedirectToPage("/AccountDetails", new { id = Card.AccountId.Value }); + } + + // Otherwise redirect to accounts list + return RedirectToPage("/Accounts"); } private async Task LoadAvailableAccountsAsync()