Init
This commit is contained in:
45
Server/Components/Pages/InvoiceListPage.razor.cs
Normal file
45
Server/Components/Pages/InvoiceListPage.razor.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user