public Task Receive(TokenReserved @event, IMessageContext context) { var tokenId = @event.AggregateId; Record(new TokenSpooled(Id, tokenId, @event.Version, @event.Code, @event.Hash)); if (Data.SpooledTokens.Count == Data.QuantityRequested) { Record(new PrintJobSpooled(Id)); } return(CompletedTask); }
public Task Receive(TokenReserved @event, IMessageContext context) { var token = tokens.SingleOrDefault(t => t.Id == @event.AggregateId); if (token != null) { token.ReservedByBillingAccountId = @event.BillingAccountId; token.State = Reserved; token.Version = @event.Version; } return(CompletedTask); }