private void PostClientListDeleteHandler(ClientListDeleteCommand c) { _logger.Info($"Deleted client list item Id{c.Id} UserName:{c.ClientListItemData.Name}."); _ActorState[c.ClientId] = c.ClientListItemData; ClientListItemDeletedEvent message = new ClientListItemDeletedEvent(c.ClientListItemData.Copy(), c.User, c.ConnectionId); NotifySubscribers(message); AutoSaveSnashot(false); }
/// <summary> /// Removes client(item) from the list. If an instance of the ClientActor is in memory it unloads it. /// </summary> /// <param name="e"></param> /// <returns></returns> private void HandleClientDeletedEvent(ClientDeletedEvent e) { // Is the item still in the list? if (_ActorState[e.Id] == null) { _logger.Info($"{e.User} tried deleting from client list id:{e.Id} but was not found."); } else { ClientListItem cliNewState = _ActorState[e.Id].Copy(); cliNewState.IsActive = false; // Memorialize that we are removing the item from the list in the journal ClientListDeleteCommand clientListDeleteCommand = new ClientListDeleteCommand( cliNewState, e.User, e.ConnectionId); _logger.Info($"Deleting client list item Id{e.Id} UserName:{e.ResultClientState.Name}."); Persist <ClientListDeleteCommand>(clientListDeleteCommand, PostClientListDeleteHandler); } }
private void DeleteClientListRecoveryCommand(ClientListDeleteCommand c) { _logger.Info($"Recovery Deleting client list item Id{c.Id} UserName:{c.ClientListItemData.Name}."); _ActorState[c.ClientId] = c.ClientListItemData; _logger.Info($"Recovery Deleted client list item Id{c.Id} UserName:{c.ClientListItemData.Name}."); }