| 12345678910111213141516171819202122 |
- using Application.Abstractions.Data;
- using Application.Abstractions.Messaging;
- using Microsoft.EntityFrameworkCore;
- namespace Application.Features.Api.DonationAlert.DeleteConfig;
- internal sealed class Handler(IAppDbContext db) : ICommandHandler<Command>
- {
- public async Task Handle(Command request, CancellationToken ct)
- {
- var config = await db.DonationAlertConfig
- .FirstOrDefaultAsync(c => c.ID == request.ID && c.ChannelID == request.ChannelID, ct);
- if (config is null)
- {
- return;
- }
- db.DonationAlertConfig.Remove(config);
- await db.SaveChangesAsync(ct);
- }
- }
|