private async Task <DialogTurnResult> ProcessConfirmationStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var infoList = new List <RequestedInfo>(); if (stepContext.GetValue <bool>(FROMNOTIFICATION)) { var result = (bool)stepContext.Result; if (result) { var requests = await PurchaseController.GetOrderRequests(); if (requests.Count == 0) { await stepContext.Context.SendActivityAsync("There's no pending orders to validate" + "you're done for today!"); return(await stepContext.EndDialogAsync(null, cancellationToken)); } else if (requests.Count == 1) { return(await stepContext.NextAsync(requests[0].CartId, cancellationToken)); } else { foreach (OrderRequest request in requests) { infoList.Add(await RequestedInfo.BuildRequestedInfoAsync(request.Cart, PrestashopApi)); } } } else { return(await stepContext.EndDialogAsync(null, cancellationToken)); } } else { var words = ((string)stepContext.Options).Split(new char[] { ' ' }).ToList(); var customers = (await PrestashopApi.GetCustomerByWords(words.ToFilterParameterList())).Customers; var carts = await PurchaseController.GetCartFromUserList(customers); foreach (Models.Cart cart in carts) { infoList.Add(await RequestedInfo.BuildRequestedInfoAsync(cart, PrestashopApi)); } } var attachments = CardUtils.RequestedListToCarousel(infoList); var reply = stepContext.Context.Activity.CreateReply(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; reply.Attachments = attachments; await stepContext.Context.SendActivityAsync(MessageFactory.Text(chooseMsg), cancellationToken); await stepContext.Context.SendActivityAsync(reply, cancellationToken); return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = MessageFactory.Text("") })); }