Ejemplo n.º 1
0
        private async Task <DialogTurnResult> SelectionStep(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var options = GetOptions(stepContext);

            var reportedUsers = options.ReportedUsers ?? new List <string>();

            stepContext.Values[ReportedUsersKey] = reportedUsers;

            var users = stepContext.Values[UserInfosKey] as List <UserDetails> ?? new List <UserDetails>();
            var user  = users.FirstOrDefault(x => !reportedUsers.Contains(x.Email));

            if (user != null)
            {
                reportedUsers.Add(user.Email);

                var ticketsReviewDialogOptions = new TicketsReviewDialogOptions()
                {
                    User = user
                };
                return(await stepContext.BeginDialogAsync(nameof(UserReviewDialog), ticketsReviewDialogOptions, cancellationToken));
            }
            else
            {
                return(await stepContext.EndDialogAsync());
            }
        }
Ejemplo n.º 2
0
        private async Task <DialogTurnResult> RepeatDialog(WaterfallStepContext stepContext, CancellationToken cancellationToken,
                                                           List <TicketInfo> tickets, List <string> reportedTickets)
        {
            var options = new TicketsReviewDialogOptions
            {
                User            = stepContext.Values[UserKey] as UserDetails,
                ReportedTickets = reportedTickets,
                Tickets         = tickets
            };

            return(await stepContext.ReplaceDialogAsync(nameof(UserReviewDialog), options, cancellationToken));
        }