public void Delete(Guid userID) { var e = new UserDeletedEvent(Guid.NewGuid(), Guid.Empty, Version+1, DateTime.UtcNow) { UserID = userID, TimeStamp = DateTime.UtcNow }; ApplyEvent(e); }
public Task ExecuteAsync(HookType type, IDomainEntityContext <User> context, CancellationToken cancellationToken) { switch (context.EditMode) { case EditMode.Create: context.AddEventAsync(UserCreatedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken); break; case EditMode.Update: context.AddEventAsync(UserUpdatedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken); break; case EditMode.Delete: context.AddEventAsync(UserDeletedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken); break; } return(Task.CompletedTask); }
public bool TranslateAkkaDeleteEventToExternalMessage(CommandEventMessage internalCommandEvent) { UserDeletedEvent e = internalCommandEvent as UserDeletedEvent; HTTPExternalInterface.HandleEDStateMessage( new HTTPDestinedCommandStateEvent( MicroServices.ProcessingStatus.Processed, e.Message, new HTTPSourcedCommand( e.CommandType.ToString(), e.Area.ToString(), null, e.ResultUserState, e.User, e.ConnectionId, e.Id ) ), false //User only? ); return(true); }
/// <summary> /// Removes User(item) from the list. If an instance of the UserActor is in memory it unloads it. /// </summary> /// <param name="e"></param> /// <returns></returns> private void HandleUserDeletedEvent(UserDeletedEvent e) { // Is the item still in the list? if (_ActorState[e.Id] == null) { _logger.Info($"{e.User} tried deleting from User list id:{e.Id} but was not found."); } else { UserListItem cliNewState = _ActorState[e.Id].Copy(); cliNewState.IsActive = false; // Memorialize that we are removing the item from the list in the journal UserListDeleteCommand UserListDeleteCommand = new UserListDeleteCommand( cliNewState, e.User, e.ConnectionId); _logger.Info($"Deleting User list item Id{e.Id} UserName:{e.ResultUserState.UserName}."); Persist <UserListDeleteCommand>(UserListDeleteCommand, PostUserListDeleteHandler); } }
public async Task HandleAsync(UserDeletedEvent domainEvent) { var user = await _userRepository.GetByIdAsync(domainEvent.AggregateId); await _userRepository.DeleteAsync(user); }
public async Task HandleAsync(UserDeletedEvent args) { await SendNotificationAsync <Guid?, User, UserDto>(args, args.User, args.User.FullName); }
protected void OnUserDeleted(UserDeletedEvent e) { _userState = UserState.Deleted; }