public async Task SelectedCategoryItem(MindshopperUserState state, ITurnContext turnContext, CancellationToken cancellationToken) { ; var response = turnContext.Activity.Text; string text = ""; var item = RecommenderClient.ProcessItem(response); if (item != null) { state.SelectedItems.Add(item); text = $"You have choosen {response}. Type \"OK\" to continue."; state.LastProcessedItem = response; state.TurnCount = State.CHOOSE_RECOMMENDED_ITEM; } else { text = $"You have choosen an invalid item. Type \"OK\" to continue and select a correct item."; state.TurnCount = State.CHOOSE_CATEGORY_ITEM; } await _accessors.MindshopperUserState.SetAsync(turnContext, state); await _accessors.ConversationState.SaveChangesAsync(turnContext); await turnContext.SendActivityAsync(text); }
public async Task SelectedRecommendedItem(MindshopperUserState state, ITurnContext turnContext, CancellationToken cancellationToken) { string text = ""; var response = turnContext.Activity.Text; if (response != null) { if (!response.ToLower().Contains("no")) { var item = RecommenderClient.ProcessItem(response); if (item != null) { state.SelectedItems.Add(item); text = $"You have choosen {response}. Type \"OK\" to continue."; state.LastProcessedItem = response; state.TurnCount = State.CHOOSE_RECOMMENDED_ITEM; } else { text = $"You have choosen an invalid item. Type \"OK\" to continue and select a correct item."; state.TurnCount = State.CHOOSE_CATEGORY_ITEM; } } else { state.TurnCount = State.CHOOSE_CATEGORY; text = $"You are being sent back to the category choosing.\n Please select the category of interest:" + $"\n\t\t1) Tobacco" + $"\n\t\t2) Liquor" + $"\n\t\t3) Food" + $"\n\t\t4) Perfumes & Cosmetics" + $"\n\t\tType\"none\" to close the cart."; } } await _accessors.MindshopperUserState.SetAsync(turnContext, state); await _accessors.ConversationState.SaveChangesAsync(turnContext); await turnContext.SendActivityAsync(text); }