initial upload
This commit is contained in:
parent
a0aa9cc28e
commit
f857f43df4
553 changed files with 46169 additions and 13 deletions
|
|
@ -0,0 +1,50 @@
|
|||
using Insight.Infrastructure;
|
||||
using Insight.Infrastructure.Entities;
|
||||
using Insight.Web.Constants;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MongoDB.Driver;
|
||||
using MudBlazor;
|
||||
|
||||
namespace Insight.Web.Pages.Management.Customers;
|
||||
|
||||
public partial class CustomerDeleteDialog
|
||||
{
|
||||
[CascadingParameter(Name = "Customer")] public CustomerEntity? Customer { get; set; }
|
||||
[Parameter] public EventCallback OnChanges { get; set; }
|
||||
|
||||
[Inject] private IMongoDatabase Database { get; init; } = default!;
|
||||
[Inject] private ISnackbar Snackbar { get; init; } = default!;
|
||||
[Inject] private ILogger<CustomerDeleteDialog> Logger { get; init; } = default!;
|
||||
|
||||
private async Task SubmitAsync()
|
||||
{
|
||||
if (Customer is null) return;
|
||||
|
||||
try
|
||||
{
|
||||
await Database.Customer()
|
||||
.DeleteOneAsync(Builders<CustomerEntity>
|
||||
.Filter.Eq(p => p.Id, Customer.Id),
|
||||
cancellationToken: default).ConfigureAwait(false);
|
||||
|
||||
Notification.Success(Snackbar);
|
||||
|
||||
if (OnChanges.HasDelegate)
|
||||
{
|
||||
await InvokeAsync(async () =>
|
||||
{
|
||||
await OnChanges.InvokeAsync(this);
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Notification.Error(Snackbar);
|
||||
Logger.LogError(ex.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
_visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue