public void Execute(DownloadPackageCommand command) { var packageId = command.PackageId; //package.EditInfo(Guid.Empty, null, null, packageDto.RowVersion); _eventStore.AddToEventQueue(new PackageDownloadedEvent(packageId)); _unitOfWork.Packages.BunpPackageDownloads(packageId); _unitOfWork.Complete(); }
public void AddPackage(PackageDto packageDto) { var package = new Package(packageDto.Id); package.EditInfo(packageDto.UserId, packageDto.Name, packageDto.Description, packageDto.RowVersion); _eventStore.AddToEventQueue(new PackageEditedEvent(packageDto.Id)); _unitOfWork.Packages.Update(package); _unitOfWork.Complete(); }
public void Execute(RegisterUserCommand command) { var userDto = command.User; var user = new User(userDto.Id); user.EditInfo(userDto.Name, null); _eventStore.AddToEventQueue(new UserRegisteredEvent(userDto.Id)); _unitOfWork.Users.Add(user); _unitOfWork.Complete(); }
public void Execute(RemoveUserCommand command) { var userDto = command.User; var user = new User(userDto.Id); user.EditInfo(null, userDto.RowVersion); _eventStore.AddToEventQueue(new PackageRemovedEvent(command.User.Id)); _unitOfWork.Users.Remove(user); _unitOfWork.Complete(); }
public void Execute(RemovePackageCommand command) { var packageDto = command.Package; var package = new Package(packageDto.Id); package.EditInfo(Guid.Empty, null, null, packageDto.RowVersion); _eventStore.AddToEventQueue(new PackageRemovedEvent(package.Id)); _unitOfWork.Packages.Remove(package); _unitOfWork.Complete(); }
public void Execute(AddReferenceProfilesToPackageCommand command) { var refProfiles = new List <ReferenceProfile>(); foreach (var referenceProfileDto in command.ReferencesProfiles) { var referenceProfile = new ReferenceProfile(Guid.NewGuid(), referenceProfileDto.PackageId, referenceProfileDto.ReferenceId); referenceProfile.EditInfo(referenceProfileDto.Name, referenceProfileDto.ReferenceVersion, null); refProfiles.Add(referenceProfile); //var profile = new MacroProfile(profileDto.Id, profileDto.PackageId, macro); //profile.UpdateProfile(profileDto.MacroPosition, profileDto.ComponentType, profileDto.ComponentName, null); //profiles.Add(profile); _eventStore.AddToEventQueue(new ReferenceProfileAddedEvent(referenceProfile.Id)); } _unitOfWork.ReferenceProfiles.AddRange(refProfiles); _unitOfWork.Complete(); }
public void Execute(RemoveReferenceProfilesFromPackageCommand command) { var profiles = new List <ReferenceProfile>(command.ReferenceProfiles.Count); foreach (var referenceProfileDto in command.ReferenceProfiles) { var referenceProfile = new ReferenceProfile(referenceProfileDto.Id, referenceProfileDto.PackageId, referenceProfileDto.ReferenceId); referenceProfile.EditInfo(referenceProfileDto.Name, referenceProfileDto.ReferenceVersion, referenceProfileDto.RowVersion); profiles.Add(referenceProfile); //var profileDto = completeMacroDto.MacroProfile; //var profile = new MacroProfile(profileDto.Id, profileDto.PackageId, macro); //profile.UpdateProfile(0, ComponentType.ClassModule, null, profileDto.RowVersion); //profiles.Add(profile); _eventStore.AddToEventQueue(new ReferenceProfileRemovedEvent(referenceProfile.Id)); } _unitOfWork.ReferenceProfiles.RemoveRange(profiles); _unitOfWork.Complete(); }
public void Execute(RemoveMacrosFromPackageCommand command) { var profiles = new List <MacroProfile>(command.CompleteMacros.Count); foreach (var completeMacroDto in command.CompleteMacros) { var macroDto = completeMacroDto.Macro; var macro = new Macro(macroDto.Id); macro.EditInfo(null, null, null, MacroType.Declaration, null); var profileDto = completeMacroDto.MacroProfile; var profile = new MacroProfile(profileDto.Id, profileDto.PackageId, macro); profile.UpdateProfile(0, ComponentType.ClassModule, null, profileDto.RowVersion); profiles.Add(profile); _eventStore.AddToEventQueue(new MacroRemovedEvent(macroDto.Id, profileDto.Id)); } _unitOfWork.MacroProfiles.RemoveRange(profiles); _unitOfWork.Complete(); }
public void Execute(AddMacrosToPackageCommand command) { var profiles = new List <MacroProfile>(command.CompleteMacros.Count); foreach (var completeMacroDto in command.CompleteMacros) { var macroDto = completeMacroDto.Macro; var profileDto = completeMacroDto.MacroProfile; var macro = new Macro(macroDto.Id); macro.EditInfo(macroDto.Name, macroDto.Description, macroDto.Code, macroDto.MacroType, null); var profile = new MacroProfile(profileDto.Id, profileDto.PackageId, macro); profile.UpdateProfile(profileDto.MacroPosition, profileDto.ComponentType, profileDto.ComponentName, null); profiles.Add(profile); _eventStore.AddToEventQueue(new MacroAddedEvent(macroDto.Id, profileDto.Id)); } _unitOfWork.MacroProfiles.AddRange(profiles); _unitOfWork.Complete(); }