AccountingNext/Schaad.Accounting.UI/Components/Pages/Dialogs/BookingRuleDialog.razor.cs
Claudio Schaad c47016cd6d Remove completed improvement plans and update NuGet packages
Drop IMPROVEMENT_PLAN.md and UI_IMPROVEMENT_PLAN.md (work tracked there has
landed) and the references to them. Update all packages to latest; Fluent UI
stays on 4.14.5 because 5.x is a breaking rewrite. Null-guard editContext in
BookingRuleDialog.SaveAsync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 13:00:28 +02:00

46 lines
No EOL
1.2 KiB
C#

using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.FluentUI.AspNetCore.Components;
using Schaad.Accounting.Interfaces;
using Schaad.Accounting.Models;
namespace Schaad.Accounting.UI.Components.Pages.Dialogs;
public partial class BookingRuleDialog : ComponentBase
{
private EditContext? editContext;
[CascadingParameter]
public FluentDialog Dialog { get; set; } = null!;
[Parameter]
public BookingRule Content { get; set; } = null!;
[Inject]
private IBookingRuleRepository bookingRuleRepository { get; set; } = null!;
[Inject]
private IViewService viewService { get; set; } = null!;
private IReadOnlyList<Account> accounts = [];
protected override async Task OnInitializedAsync()
{
editContext = new EditContext(Content);
accounts = await viewService.GetAccountViewListAsync();
}
private async Task SaveAsync()
{
if (editContext is not null && editContext.Validate())
{
await bookingRuleRepository.SaveBookingRuleAsync(Content);
await Dialog.CloseAsync(Content);
}
}
private async Task CancelAsync()
{
await Dialog.CancelAsync();
}
}