45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Server.Data;
|
|
using Server.Model;
|
|
|
|
namespace Server.Components.Pages
|
|
{
|
|
public partial class InvoiceListPage : ComponentBase
|
|
{
|
|
#region Private Properties
|
|
|
|
private List<InvoiceModel>? Invoices { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region Override SetParametersAsync
|
|
|
|
//// <inheritdoc />
|
|
public override async Task SetParametersAsync(ParameterView parameters)
|
|
{
|
|
parameters.SetParameterProperties(this);
|
|
|
|
Invoices = await InvoiceData.LoadAllAsync();
|
|
|
|
await base.SetParametersAsync(ParameterView.Empty);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Private Method DeleteInvoiceAsync
|
|
|
|
/// <summary>
|
|
/// Deletes an invoice asynchronously by its ID.
|
|
/// </summary>
|
|
/// <param name="invoiceInvoiceId">The ID of the invoice to be deleted.</param>
|
|
/// <returns>A task representing the asynchronous delete operation.</returns>
|
|
private async Task DeleteInvoiceAsync(string? invoiceInvoiceId)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(invoiceInvoiceId)) return;
|
|
await InvoiceData.DeleteAsync(invoiceInvoiceId);
|
|
Invoices = await InvoiceData.LoadAllAsync();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |