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