public async Task <Guid> Persist(ReleasePlayerInstructionCreatedEvent e, CancellationToken ct) { var entity = Map(e); await _transferInstructions.InsertOneAsync(entity, null, ct); return(entity.Id); }
public async Task <Guid> FindMatchingTransferInstructionId( ReleasePlayerInstructionCreatedEvent e, CancellationToken ct) { return(await Query() .Find(i => i.EngagingClubId == e.EngagingClubId && i.ReleasingClubId == e.ReleasingClubId && i.PlayerId == e.PlayerId && i.Type == TransferInstructionType.Engaging ).Project(x => x.Id) .FirstOrDefaultAsync(ct)); }
private TransferInstruction Map(ReleasePlayerInstructionCreatedEvent e) { return(new() { EngagingClubId = e.EngagingClubId, ReleasingClubId = e.ReleasingClubId, PlayerId = e.PlayerId, PlayersContract = e.PlayersContract, Type = TransferInstructionType.Releasing, CreatedOn = DateTime.Now }); }