Пример #1
0
        public async void Execute()
        {
            var course = _message.Text;

            bool?isYoung = null;
            bool?isAnsweredAllQuestions = null;

            if (string.Compare(course, "1-3", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                isYoung = true;
                isAnsweredAllQuestions = true;
            }

            if (string.Compare(course, "4 и старше", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                isYoung = false;
                isAnsweredAllQuestions = true;
            }

            await MongoDBHelper.SaveCourse(_chatId, isYoung.HasValue?course : null, isAnsweredAllQuestions);

            if (isYoung.HasValue)
            {
                await _botClient.SendTextMessageAsync(_chatId, MessageFactory.EndOfAskingMessage, replyMarkup : BotHelper.GetRemoveKeyboard());

                if (!isYoung.Value)
                {
                    await _botClient.SendTextMessageAsync(_chatId, MessageFactory.OpenDoorsInvitationMessage);
                }
            }
            else
            {
                await _botClient.SendTextMessageAsync(_chatId, MessageFactory.AskCourseMessage,
                                                      replyMarkup : BotHelper.GetKeyboardForCourse());
            }
        }
        public async void Execute()
        {
            var university = _message.Text;

            await MongoDBHelper.SaveUniversity(_chatId, university);

            await _botClient.SendTextMessageAsync(_chatId, MessageFactory.AskCourseMessage, replyMarkup : BotHelper.GetKeyboardForCourse());
        }