private async Task <DialogTurnResult> ShoesSuggestionPromptAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { shoesState = await UserProfileAccessor.GetAsync(stepContext.Context); var ShoesList = await ShoesSuggestionListAsync(); //var dc = stepContext.Context.Activity; //var lowerCasePrice = stepContext.Result as string ; //if (string.IsNullOrWhiteSpace(shoesState.Categorie) && lowerCasePrice != null) //{ // shoesState.PriceMin = Convert.ToDouble(lowerCasePrice); // await UserProfileAccessor.SetAsync(stepContext.Context, shoesState); //} var opts = new PromptOptions { Prompt = new Activity { Text = ShoesList.Count == 0? $"could not find anything" : $"What do you think of these?", Type = ActivityTypes.Message, Attachments = ShoesList, AttachmentLayout = AttachmentLayoutTypes.Carousel, }, }; return(await stepContext.PromptAsync(ShoesListPrompt, opts)); }
public static async Task <List <Product> > GetProductByCategorie(ShoesState shoesState) { using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://localhost:44307/"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var stringContent = new StringContent(JsonConvert.SerializeObject(shoesState), Encoding.UTF8, "application/json"); var response = await client.PostAsync("api/Products/ProductByCategorie", stringContent); var result = response.Content.ReadAsStringAsync().Result; return(JsonConvert.DeserializeObject <List <Product> >(result)); } }