Example #1
0
        public async Task HandleEvent(ProductCreatedEvent @event)
        {
            if (string.IsNullOrEmpty(@event.CurrencyCode))
            {
                return;
            }

            var lastPrice = new PriceErrorAlertLastPrice
            {
                ProductId        = @event.AggregateId,
                Price            = @event.Price,
                CurrencyCode     = @event.CurrencyCode,
                DateLastModified = @event.EventDate
            };
            await _context.AddAsync(lastPrice);

            await _context.SaveChangesAsync();
        }