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 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)); }