private async Task ShouldCreateCase(IDialogContext context, IAwaitable <bool> input) { try { bool createCase = await input; if (createCase) { var client = new CrmSearchClient(); var result = await client.CreateCase(this.lastSearch); await context.PostAsync($"A case has been created. Your case number is {result}"); context.Done(true); } else { await context.PostAsync("Thank you for contacting support. Let me know if there is anything else I can help with."); context.Done(true); } } catch (TooManyAttemptsException) { context.Done(true); } }
public async Task Search(IDialogContext context, IAwaitable <string> input) { string text = input != null ? await input : null; var client = new CrmSearchClient(); var result = await client.SearchAsync(text); var cards = result.EntityCollection.Entities.Select(e => ToThumbNailCard(e)); var replyToConversation = context.MakeMessage(); replyToConversation.Text = "Here are some potential solutions..."; replyToConversation.AttachmentLayout = AttachmentLayoutTypes.Carousel; replyToConversation.Attachments = new List <Attachment>(); foreach (var card in cards) { replyToConversation.Attachments.Add(card.ToAttachment()); } await context.PostAsync(replyToConversation); PromptDialog.Confirm(context, this.SolveProblem, "Did any of the articles solve your issue?"); }