Пример #1
0
        public void Project(ConcertTicketsBoughtEvent @event)
        {
            _concerts.TryGetConcert(@event.ConcertId, out ConcertProjection concert);

            TicketsBoughtProjection ticketBoughtProjection = new TicketsBoughtProjection(@event.UserId, @event.ConcertId, @event.NumberOfTickets, concert?.Title ?? string.Empty);

            _tickets.Add(ticketBoughtProjection);
        }
Пример #2
0
        public void Project(ConcertTicketsBoughtEvent @event)
        {
            if (!_concerts.TryGetConcert(@event.ConcertId, out ConcertProjection concert))
            {
                return;
            }

            _concerts.Update(new ConcertProjection(concert.Id, concert.Title, concert.TicketBought + @event.NumberOfTickets, concert.MaximumNumberOfTickets));
        }