Example #1
0
        public async Task Consume(ConsumeContext <MembershipCreatedEvent> context)
        {
            var entity = await _context.MembershipPointsReporting.FirstOrDefaultAsync(c => c.CustomerId == context.Message.CustomerId);

            entity.ApplyEvent(context.Message);
            _context.Update(entity);
            await _context.SaveChangesAsync();
        }
Example #2
0
        public async Task Handle(MembershipCreatedEvent simpleEvent)
        {
            var entity = await _context.MembershipPointsReporting.FirstOrDefaultAsync(c => c.CustomerId == simpleEvent.CustomerId);

            entity.ApplyEvent(simpleEvent);
            _context.Update(entity);
            await _context.SaveChangesAsync();
        }