public async Task HandleAsync(RegisterPlayerCommand command) { Player player = await _registerPlayerService.RegisterPlayer( command.PlayerId, command.Username, command.Password ); await _playerStore.SaveAsync(player); }
public async Task HandleAsync(InitiateCircleCommand command) { Player player = await _playerStore.LoadAsync(command.PlayerId); if (player == null) { throw new PlayerDoesNotExistException(); } Circle circle = await _initiateCircleService.InitiateCircle( command.CircleId, command.PlayerId, command.Name, command.Key ); await _circleStore.SaveAsync(circle); }
public async Task HandleAsync(BetrayCircleCommand command) { Player player = await _playerStore.LoadAsync(command.PlayerId); if (player == null) { throw new PlayerDoesNotExistException(); } Circle circle = await _circleStore.LoadAsync(command.CircleId); if (circle == null) { throw new CircleDoesNotExistException(); } BetrayedCircle betrayedCircle = await _betrayCircleService.BetrayCircle( command.BetrayedCircleId, command.CircleId, command.PlayerId, command.Key ); await _betrayedCircleStore.SaveAsync(betrayedCircle); }
public async Task HandleAsync(JoinCircleCommand command) { Player player = await _playerStore.LoadAsync(command.PlayerId); if (player == null) { throw new PlayerDoesNotExistException(); } Circle circle = await _circleStore.LoadAsync(command.CircleId); if (circle == null) { throw new CircleDoesNotExistException(); } Member member = await _joinCircleService.JoinCircle( command.MemberId, command.PlayerId, command.CircleId, command.Key ); await _memberStore.SaveAsync(member); }