private async Task TitleValidator(ITurnContext context, Prompts.TextResult result) { if (string.IsNullOrWhiteSpace(result.Value) || result.Value.Length < 3) { result.Status = Prompts.PromptStatus.NotRecognized; await context.SendActivity("Title should be at least 3 characters long."); } }
private static async Task NameValidator(ITurnContext context, BotPrompts.TextResult result) { if (result.Value.Length <= 6 || (result.Value.Length > 25)) { result.Status = BotPrompts.PromptStatus.TooSmall; await context.SendActivity("Your name should be at least 6 and at most 25 characters long."); } }
private async Task ProductPrompt(ITurnContext context, Prompts.TextResult result) { if (string.IsNullOrWhiteSpace(result.Value)) { var entry = new ShoppingCartEntry { ProductName = result.Value, Amount = 1 }; _dataContext.ShoppingCartEntries.Add(entry); _dataContext.SaveChanges(); await context.SendActivity($"Ow, dat, zeg dat dan! Staat er nu op."); result.Status = Prompts.PromptStatus.Recognized; } result.Status = Prompts.PromptStatus.NotRecognized; }