public Either <DomainError, ServiceResponse> Execute(string playListName) { var newPlayListId = uniqueIdentifiers.GetNewUniqueIdentifier(); var playList = PlayList.Create(newPlayListId, playListName); playListPersistence.Persist(playList); eventPublisher.Publish(playList.Events()); return(ServiceResponse.Success); }
public Either <DomainError, CommandResult> Handle(CreatePLayList command) { var newPlayListId = uniqueIdentifiers.GetNewUniqueIdentifier(); var playList = PlayList.Create(newPlayListId, command.PlayListName); playListPersistence.Persist(playList); eventPublisher.Publish(playList.Events()); return(CommandResult.Success); }
public Either <DomainError, CommandResult> Handle(RenamePlaylist command) { var playList = playListPersistence.GetPlayList(command.PlaylistId); playList.Rename(command.NewPlayListName); playListPersistence.Persist(playList); eventPublisher.Publish(playList.Events()); return(CommandResult.Success); }
public Either <DomainError, ServiceResponse> Execute(string playListId, string newPlayListName) { var playList = playListPersistence.GetPlayList(playListId); playList.Rename(newPlayListName); playListPersistence.Persist(playList); eventPublisher.Publish(playList.Events()); return(ServiceResponse.Success); }
public Either <DomainError, ServiceResponse> Execute(string playListId, string aNewImageUrL) { var playList = playListPersistence.GetPlayList(playListId); playList.AddImageUrl(aNewImageUrL); playListPersistence.Persist(playList); eventPublisher.Publish(playList.Events()); return(ServiceResponse.Success); }
public Either <DomainError, CommandResult> Handle(ChangePlayListImageUrl command) { var playList = playListPersistence.GetPlayList(command.PlaylistId); playList.AddImageUrl(command.NewImageUrl); playListPersistence.Persist(playList); eventPublisher.Publish(playList.Events()); return(CommandResult.Success); }
public Either <DomainError, ServiceResponse> Execute(string trackId, string playlistId) { var playList = playListPersistence.GetPlayList(playlistId); var error = playList.Add(Track.With(trackId)); if (error.IsSome) { return(error.ValueUnsafe()); } playListPersistence.Persist(playList); eventPublisher.Publish(playList.Events()); return(ServiceResponse.Success); }
public Either <DomainError, CommandResult> Handle(RemoveTrackFromPlayList command) { var playList = playListPersistence.GetPlayList(command.PlaylistId); var error = playList.Remove(command.TrackId); if (error.IsSome) { return(error.ValueUnsafe()); } playListPersistence.Persist(playList); eventPublisher.Publish(playList.Events()); return(CommandResult.Success); }