public override void When(BookAddedToLibrary @event)
        {
            OpenedLibrary library = Session.Get <OpenedLibrary>(@event.AggregateId);

            Session.Save(new LibraryBook(@event.ProcessId, library, @event.Title, @event.Author,
                                         @event.Isbn, @event.PublishYear));
        }
Ejemplo n.º 2
0
        public override void When(Domain.RequestLink.LinkRequested @event)
        {
            OpenedLibrary requestingLibrary = Session.Get <OpenedLibrary>(@event.AggregateId);
            OpenedLibrary targetLibrary     = Session.Get <OpenedLibrary>(@event.TargetLibraryId);

            Session.Save(new RequestedLink(@event.ProcessId, requestingLibrary, targetLibrary));
        }
Ejemplo n.º 3
0
 public LibraryLink(Guid processId, OpenedLibrary requestingLibrary, OpenedLibrary acceptingLibrary)
 {
     ProcessId                      = processId;
     RequestingLibraryId            = requestingLibrary.Id;
     RequestingLibraryName          = requestingLibrary.Name;
     RequestingAdministratorId      = requestingLibrary.AdministratorId;
     RequestingAdministratorPicture = requestingLibrary.AdministratorPicture;
     AcceptingLibraryId             = acceptingLibrary.Id;
     AcceptingLibraryName           = acceptingLibrary.Name;
     AcceptingAdministratorId       = acceptingLibrary.AdministratorId;
     AcceptingAdministratorPicture  = acceptingLibrary.AdministratorPicture;
 }
Ejemplo n.º 4
0
 public LibraryBook(Guid processId, OpenedLibrary library, string title, string author, string isbn, int publishYear)
 {
     ProcessId            = processId;
     LibraryId            = library.Id;
     LibraryName          = library.Name;
     LibraryAdminId       = library.AdministratorId;
     AdministratorPicture = library.AdministratorPicture;
     Title       = title;
     Author      = author;
     Isbn        = isbn;
     PublishYear = publishYear;
 }
Ejemplo n.º 5
0
 public RequestedLink(Guid processId, OpenedLibrary requestingLibrary, OpenedLibrary targetLibrary)
 {
     ProcessId                      = processId;
     RequestingLibraryId            = requestingLibrary.Id;
     RequestingLibraryName          = requestingLibrary.Name;
     RequestingAdministratorId      = requestingLibrary.AdministratorId;
     RequestingAdministratorPicture = requestingLibrary.AdministratorPicture;
     TargetLibraryId                = targetLibrary.Id;
     TargetLibraryName              = targetLibrary.Name;
     TargetAdministratorId          = targetLibrary.AdministratorId;
     TargetAdministratorPicture     = targetLibrary.AdministratorPicture;
 }
Ejemplo n.º 6
0
        public override void When(Domain.AcceptLink.LinkAccepted @event)
        {
            RequestedLink requestedLink = Session.QueryOver <RequestedLink>()
                                          .Where(x => x.RequestingLibraryId == @event.RequestingLibraryId)
                                          .Where(x => x.TargetLibraryId == @event.AggregateId)
                                          .SingleOrDefault();

            Session.Delete(requestedLink);

            OpenedLibrary requestingLibrary = Session.Get <OpenedLibrary>(@event.RequestingLibraryId);
            OpenedLibrary acceptingLibrary  = Session.Get <OpenedLibrary>(@event.AggregateId);

            Session.Save(new LibraryLink(@event.ProcessId, requestingLibrary, acceptingLibrary));
        }