public async Task <CharacterLocationDto> Handle(MoveCharacterCommand request, CancellationToken cancellationToken) { var characterLocation = await _characterLocationRepository.GetByCharacterIdAsync(request.CharacterId, cancellationToken); if (characterLocation != null) { characterLocation.ChangeLocation(request.X, request.Y); } else { characterLocation = CharacterLocation.Create(request.CharacterId, request.X, request.Y, _singleLocationPerCharacterChecker); await _characterLocationRepository.AddAsync(characterLocation, cancellationToken); } await _unitOfWork.CommitAsync(cancellationToken); return(CharacterLocationDto.FromCharacterLocation(characterLocation)); }
public async Task <bool> CharacterHasNoLocationAsync(Guid characterId) { return(await _characterLocationRepository.GetByCharacterIdAsync(characterId) == null); }
public async Task <CharacterLocationDto> Handle(GetCharacterLocationQuery request, CancellationToken cancellationToken) { var characterLocation = await _characterLocationRepository.GetByCharacterIdAsync(request.CharacterId, cancellationToken); return(characterLocation == null ? null : CharacterLocationDto.FromCharacterLocation(characterLocation)); }