@using Moonlight.App.Database.Entities
@using Moonlight.App.Services
@using Moonlight.App.Services.Interop

@inject SmartTranslateService SmartTranslateService
@inject AlertService AlertService
@inject NavigationManager NavigationManager
@inject ServerService ServerService

<WButton Text="@(SmartTranslateService.Translate("Delete"))"
         WorkingText="@(SmartTranslateService.Translate("Deleting"))"
         CssClasses="btn-danger"
         OnClick="OnClick">
</WButton>

@code
{
    [CascadingParameter]
    public Server CurrentServer { get; set; }

    private async Task OnClick()
    {
        if (await AlertService.ConfirmMath())
        {
            await ServerService.Delete(CurrentServer);
            NavigationManager.NavigateTo("/servers", true);
        }
    }
}