Beispiel #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);
        }
        public void Add(TicketsBoughtProjection item)
        {
            lock (_object) {
                List <TicketsBoughtProjection> tickets;
                if (!_tickets.TryGetValue(item.UserId, out tickets))
                {
                    tickets = new List <TicketsBoughtProjection>();
                    _tickets[item.UserId] = tickets;
                }

                tickets.Add(item);
            }
        }