using Microsoft.EntityFrameworkCore; using PnvPanel.Application.Common.Interfaces; using LiteCqrs; using PnvPanel.Application.Common.Models; namespace PnvPanel.Application.Admin.Instructions; public sealed class DeleteInstructionTabCommandHandler(IAppDbContext dbContext) : ICommandHandler { public async Task Handle( DeleteInstructionTabCommand command, CancellationToken cancellationToken ) { var tab = await dbContext.InstructionTabs.FirstOrDefaultAsync( t => t.Id == command.TabId, cancellationToken ); if (tab is null) return Result.Failure(InstructionErrors.TabNotFound); dbContext.InstructionTabs.Remove(tab); return Result.Success(); } }