Handler.cs 528 B

123456789101112131415161718
  1. using Application.Abstractions.Messaging;
  2. using Application.Abstractions.Data;
  3. using Microsoft.EntityFrameworkCore;
  4. namespace Application.Features.Director.AccessLog.Delete;
  5. public sealed class Handler(IAppDbContext db) : ICommandHandler<Command>
  6. {
  7. public async Task Handle(Command request, CancellationToken ct)
  8. {
  9. if (request.IDs is null || request.IDs.Length == 0)
  10. {
  11. return;
  12. }
  13. await db.AdminAccessLog.Where(x => request.IDs.Contains(x.ID)).ExecuteDeleteAsync(ct);
  14. }
  15. }