예제 #1
0
        public MessageEventResult HandleEvent(MessageEvent messageEvent)
        {
            if (!int.TryParse(messageEvent.Message, out int recipient) || !Enum.IsDefined(typeof(Recipients), recipient))
            {
                throw new PreviousStateUserAnswerException($"Некорректное значение одаряемого {messageEvent.Message}");
            }

            _stateMachine.GiftCriteria.AddRecipient((Recipients)recipient);

            var inlineKeyboard = KeyboardGenerator.GetFromEnum <AgeCategories>();

            return(new MessageEventResult(inlineKeyboard, "Выберите возрастную категорию"));
        }
예제 #2
0
        public MessageEventResult HandleEvent(MessageEvent messageEvent)
        {
            if (!int.TryParse(messageEvent.Message, out int age) || !Enum.IsDefined(typeof(AgeCategories), age))
            {
                throw new PreviousStateUserAnswerException($"Некорректное значение возраста {messageEvent.Message}");
            }

            _stateMachine.GiftCriteria.AddAgeCategory((AgeCategories)age);

            var inlineKeyboard = KeyboardGenerator.GetFromEnum <PriceCategories>();

            return(new MessageEventResult(inlineKeyboard, "Выберите ценовую категорию подарка"));
        }
예제 #3
0
        public MessageEventResult HandleEvent(MessageEvent messageEvent)
        {
            var inlineKeyboard = KeyboardGenerator.GetFromEnum <Recipients>();

            return(new MessageEventResult(inlineKeyboard, "Кому вы выбираете подарок?"));
        }