public bool Handle(CheckExistsRequest <Character> message) { return((!String.IsNullOrWhiteSpace(message.OtherThanId) ? _client.Characters.GetDocumentQuery().Where(c => (c.Id != message.OtherThanId) && (c.Name == message.Name)) : _client.Characters.GetDocumentQuery().Where(c => c.Name == message.Name)).Take(1).ToArray().Length > 0); }
public async Task <bool> Handle(CheckExistsRequest <Character> request, CancellationToken cancellationToken) { return(await(!String.IsNullOrWhiteSpace(request.OtherThanId) ? _client.Characters.GetDocumentQuery().Where(c => (c.Id != request.OtherThanId) && (c.Name == request.Name)) : _client.Characters.GetDocumentQuery().Where(c => c.Name == request.Name)).Take(1).ToAsyncEnumerable().Any()); }