Ejemplo n.º 1
0
        public async Task <Unit> Handle(ReadEmailCommand command, CancellationToken cancellationToken)
        {
            _logger.LogDebug($"Handle ReadEmailCommand:{JsonConvert.SerializeObject(command)}");

            var playerId      = command.PlayerId;
            var playerEmailId = command.PlayerEmailId;

            var playerEmail = await _playerEmailDomainService.Get(playerEmailId);

            if (playerEmail == null || playerEmail.PlayerId != playerId)
            {
                return(Unit.Value);
            }

            playerEmail.Status = EmailStatusEnum.已读;
            await _playerEmailDomainService.Update(playerEmail);

            if (await Commit())
            {
                //TODO
                await _mudProvider.RemoveEmail(playerId, playerEmailId);

                await _bus.RaiseEvent(new DeletedEmailEvent(playerId, playerEmailId)).ConfigureAwait(false);
            }

            return(Unit.Value);
        }
Ejemplo n.º 2
0
        public async Task ReadEmail(ReadEmailAction showEmailAction)
        {
            var result = await DoCommand(async() => {
                var playerId = _account.PlayerId;

                var command = new ReadEmailCommand(playerId, showEmailAction.PlayerEmailId);
                await _bus.SendCommand(command);
            });
        }