Beispiel #1
0
        public void Handle(BookInventoryInStoredEvent evt)
        {
            _reportDataAccessor.UpdateBookInventoryStatus(evt.AggregateId, BookInventoryStatus.InStore, evt.Notes);
            _reportDataAccessor.Commit();

            _commandTracker.DirectFinish(evt.CommandUniqueId);
        }
        public void Handle(BookAddedEvent evt)
        {
            _reportDataAccessor.AddBook(new AddBookDTO
            {
                BookId      = evt.AggregateId,
                BookName    = evt.BookName,
                Description = evt.Description,
                ISBN        = evt.ISBN,
                DateIssued  = evt.DateIssued
            });

            _reportDataAccessor.Commit();
            _commandTracker.DirectFinish(evt.CommandUniqueId);
        }
Beispiel #3
0
        public void Handle(RentedBookOutStoredEvent evt)
        {
            try
            {
                _reportDataAccessor.UpdateBookInventoryStatus(evt.AggregateId, BookInventoryStatus.OutStore, evt.Notes);
                _reportDataAccessor.Commit();

                var rentBookRequestSucceedEvent = new RentBookRequestSucceedEvent
                {
                    CommandUniqueId = evt.CommandUniqueId,
                    BookInventoryId = evt.AggregateId,
                    CustomerId      = evt.CustomerId,
                    AggregateId     = evt.AggregateId
                };

                _eventPublisher.Publish(rentBookRequestSucceedEvent);
            }
            catch
            {
            }
        }
Beispiel #4
0
 public void Handle(BookIssuedDateChangedEvent evt)
 {
     _reportDataAccessor.UpdateBookIssuedDate(evt.AggregateId, evt.NewBookIssuedDate);
     _reportDataAccessor.Commit();
 }
 public void Handle(BookDescriptionChangedEvent evt)
 {
     _reportDataAccessor.UpdateBookDescription(evt.AggregateId, evt.Description);
     _reportDataAccessor.Commit();
 }