how to pass set value in one method to another

Jan 29 2020 7:52 PM
i am trying to pass Set vlue in one method to another method in bot framework using C#
 
i wrote two methods
 
This is my first method
  1. if (item.PromptOption != "NULL")  
  2. {  
  3. if (item.PromptOption.Split('!').Length >= 1)  
  4. {  
  5. questionTExt = item.PromptOption.Split('!')[0];  
  6. lstConfirmAction1 = new List<string>();  
  7. int getLen = item.PromptOption.Split('!')[1].Split('$').Count();  
  8. for (int i = 0; i < getLen; i++)  
  9. {  
  10. lstConfirmAction1.Add(item.PromptOption.Split('!')[1].Split('$')[i]);  
  11. }  
  12. // lstConfirmAction.Add(item.PromptOption.Split('!')[1].Split('$')[1]);  
  13. }  
  14. context.UserData.SetValue(questionTExt, questionTExt);  
  15. var val= context.UserData.GetValue<string>(questionTExt);  
  16. PromptDialog.Choice(context, this.OnFeedback, lstActions, questiontext, null, 3);  
  17. }  
My second method
  1. private async Task OnFeedback(IDialogContext context, IAwaitable<string> result)  
  2. {  
  3. string selectedStatus = string.Empty;  
  4. selectedStatus = await result;  
  5. var item = trbList1.Where(a => a.ID == childID && a.HeaderOption.ToLower() == selectedStatus.ToLower()).FirstOrDefault();  
  6. if (!string.IsNullOrEmpty(item.Text))  
  7. {  
  8. if (item.Text == "break")  
  9. {  
  10. isTriggered = false;  
  11. SaveQnAData(context, "YES""TRUE");  
  12. await context.PostAsync("Thank You");  
  13. }  
  14. else  
  15. {  
  16. var qst = context.UserData.GetValue<string>(questionTExt);  
  17. botCon.KyraConverastionDetails.BotReply = qst;  
  18. await context.PostAsync(item.Text);  
  19. }  
  20. }  
  21. }  

Answers (1)