Ejemplo n.º 1
0
        private async Task <DialogTurnResult> FinalStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            string action = stepContext.GetValue <string>(ACTION);

            if ((bool)stepContext.Result)
            {
                var userId = stepContext.Context.Activity.From.Id;

                if (action == "confirmOrder")
                {
                    var cart = await PurchaseController.GetActiveCartFromUser(userId);

                    var order = await Store.Entity.PostOrder.BuildOrderAsync(cart, PrestashopApi);
                }

                await PurchaseController.InactivateCartFromUser(userId);

                string filling = action == "confirmOrder" ? "sent" : "cancelled";

                await stepContext.Context.SendActivityAsync(MessageFactory.Text("Your order was " + filling + " successfully!"), cancellationToken);
            }
            else
            {
                await stepContext.Context.SendActivityAsync(MessageFactory.Text(ignoreOrder), cancellationToken);
            }


            return(await stepContext.EndDialogAsync(null, cancellationToken));
        }