initial commit

This commit is contained in:
2026-07-21 14:35:37 +07:00
commit 0027997ff9
798 changed files with 59083 additions and 0 deletions
@@ -0,0 +1,30 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Thirdparty.Customer.Cqrs;
public record DeleteCustomerContactCommand(string Id) : IRequest<bool>;
public class DeleteCustomerContactHandler : IRequestHandler<DeleteCustomerContactCommand, bool>
{
private readonly AppDbContext _context;
public DeleteCustomerContactHandler(AppDbContext context) => _context = context;
public async Task<bool> Handle(DeleteCustomerContactCommand request, CancellationToken cancellationToken)
{
var entity = await _context.CustomerContact
.FirstOrDefaultAsync(x => x.Id == request.Id, cancellationToken);
if (entity == null)
{
return false;
}
_context.CustomerContact.Remove(entity);
await _context.SaveChangesAsync(cancellationToken);
return true;
}
}