@using LinkDotNet.Blog.Domain @using LinkDotNet.Blog.Infrastructure.Persistence @using LinkDotNet.Blog.Web.Features.Services.Tags @using NCronJob @inject NavigationManager NavigationManager @inject IToastService ToastService @inject IRepository BlogPostRepository @inject IInstantJobRegistry InstantJobRegistry @inject ITagQueryService TagQueryService
Edit
@code { [Parameter, EditorRequired] public required string BlogPostId { get; set; } private ConfirmDialog ConfirmDialog { get; set; } = default!; private async Task DeleteBlogPostAsync() { await BlogPostRepository.DeleteAsync(BlogPostId); await TagQueryService.ClearTagCacheAsync(); InstantJobRegistry.RunInstantJob(true); ToastService.ShowSuccess("The Blog Post was successfully deleted"); NavigationManager.NavigateTo("/"); } private void ShowConfirmDialog() { ConfirmDialog.Open(); } }