initial commit

This commit is contained in:
2026-07-21 14:14:44 +07:00
commit fa7dbb970d
1359 changed files with 104110 additions and 0 deletions
@@ -0,0 +1,27 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Thirdparty.CustomerGroup.Cqrs;
public record DeleteCustomerGroupByIdRequest(string Id);
public record DeleteCustomerGroupByIdCommand(DeleteCustomerGroupByIdRequest Data) : IRequest<bool>;
public class DeleteCustomerGroupByIdHandler : IRequestHandler<DeleteCustomerGroupByIdCommand, bool>
{
private readonly AppDbContext _context;
public DeleteCustomerGroupByIdHandler(AppDbContext context) => _context = context;
public async Task<bool> Handle(DeleteCustomerGroupByIdCommand request, CancellationToken cancellationToken)
{
var entity = await _context.CustomerGroup
.FirstOrDefaultAsync(x => x.Id == request.Data.Id, cancellationToken);
if (entity == null) return false;
_context.CustomerGroup.Remove(entity);
return await _context.SaveChangesAsync(cancellationToken) > 0;
}
}