namespace Brizco.Repository.Handlers.Tasks; public class DeleteActivityCommandHandler(IRepositoryWrapper repositoryWrapper) : IRequestHandler { public async Task Handle(DeleteTaskCommand request, CancellationToken cancellationToken) { var task = await repositoryWrapper.SetRepository() .TableNoTracking .FirstOrDefaultAsync(s => s.Id == request.Id, cancellationToken); if (task == null) throw new AppException("Task not found", ApiResultStatusCode.NotFound); repositoryWrapper.SetRepository() .Delete(task); await repositoryWrapper.SaveChangesAsync(cancellationToken); return true; } }