PR U-2: guard TransactionDialog.SaveAsync against a cleared date
Guard SaveAsync against a null SelectedValue (previously SelectedValue!.Value threw InvalidOperationException) and disable the Save button while the date is empty so the user gets a visible cue. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
60f01d437c
commit
70f9ce0d58
2 changed files with 7 additions and 2 deletions
|
|
@ -56,6 +56,7 @@
|
|||
Abbrechen
|
||||
</FluentButton>
|
||||
<FluentButton Appearance="Appearance.Accent"
|
||||
Disabled="@(SelectedValue is null)"
|
||||
OnClick="@SaveAsync">
|
||||
Speichern
|
||||
</FluentButton>
|
||||
|
|
|
|||
|
|
@ -34,10 +34,14 @@ public partial class TransactionDialog : ComponentBase
|
|||
|
||||
private async Task SaveAsync()
|
||||
{
|
||||
if (editContext is null || SelectedValue is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (editContext.Validate())
|
||||
{
|
||||
Content.ValueDate = SelectedValue!.Value;
|
||||
Content.BookingDate = SelectedValue!.Value;
|
||||
Content.ValueDate = SelectedValue.Value;
|
||||
Content.BookingDate = SelectedValue.Value;
|
||||
await transactionRepository.SaveTransactionAsync(Content);
|
||||
await Dialog.CloseAsync(Content);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue