public async Task <CarAddedToInventory> Handle(RequestAddCarToInventory request, CancellationToken cancellationToken) { var ivt = new Inventory { Id = request.AggregateId, CarId = request.CarId, Lot = request.Lot, Quantity = request.Quanity }; context.Inventory.Add(ivt); await context.SaveChangesAsync(); var evt = CarAddedToInventory.From(ivt); await mediator.Publish(AggregateEvent.Create <RequestAddCarToInventory>(request.AggregateId, evt, request)); await mediator.Publish(evt); return(evt); }
public async Task Handle(CarCreated notification, CancellationToken cancellationToken) => await mediator.Send(RequestAddCarToInventory.From(notification));