示例#1
0
        private string GetResultMessage(ITurnContext <IMessageActivity> turnContext, AlexaConversation alexaConversation)
        {
            alexaConversation.Count++;

            var correct = turnContext.Activity.Text.Equals(alexaConversation.Phrase, StringComparison.InvariantCultureIgnoreCase);
            var random  = new Random();

            var resultMessage = correct
                ? $"{CorrectMessages[random.Next(0, CorrectMessages.Length - 1)]} Seguimos. Dime otra palabra o frase para trabajar."
                : $@"Hmmm, entendí: ""{turnContext.Activity.Text}"". {TryAgainMessages[random.Next(0, TryAgainMessages.Length - 1)]}. Dime ""{alexaConversation.Phrase}"" ahora!";

            if (correct)
            {
                alexaConversation.Phrase          = null;
                alexaConversation.CurrentExercise = null;
            }

            return(resultMessage);
        }
示例#2
0
 private async Task <Exercise> CreateExerciseAsync(AlexaConversation alexaConversation)
 {
     return(await _mediator.Send(new CreateExerciseCommand("José Manuel", alexaConversation.Phrase, alexaConversation.Language)));
 }