/// <inheritdoc /> protected override async Task OnInlineQueryAsync(ITurnContext turnContext, InlineQuery inlineQuery, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(inlineQuery.Query)) { return; } var statePropertyAccessor = _userState.CreateProperty <DuckUserState>(nameof(DuckUserState)); var user = await statePropertyAccessor.GetAsync(turnContext, () => new DuckUserState(), cancellationToken); var duckResponse = await _imagesService.GetAsync(inlineQuery.Query, user, cancellationToken); var answer = CreateAnswerInlineQuery(inlineQuery, duckResponse); var reply = turnContext.CreateBotReply(answer); user.Vqd = duckResponse.Vqd; user.Next = duckResponse.Next; user.Query = inlineQuery.Query; await turnContext.SendActivityAsync(reply, cancellationToken); await _userState.SaveChangesAsync(turnContext, false, cancellationToken); }
public async Task <IActionResult> GetAsync(Guid id) { var img = await _imagesService.GetAsync(id); return(Ok(_mapper.Map <ImageModel>(img))); }