Beispiel #1
0
        public GalleryCard GetGalleryCard(Guid OptionId)
        {
            OptionCardModel cardResult = (from opt in _db.Options
                                          where opt.OptionId == OptionId
                                          select new OptionCardModel()
            {
                Title = opt.Title,
                Description = opt.Body,
                OptionId = opt.OptionId,
                ParentOptionId = opt.ParentOptionId,
                Result = opt.Result,
                Options = (from opt2 in _db.Options where opt2.ParentOptionId == opt.OptionId select opt2).ToList()
            }).SingleOrDefault();

            var galleryCard = new GalleryCard();

            galleryCard.BotName     = "Botty";
            galleryCard.Title       = cardResult.Title;
            galleryCard.UrlImage    = "https://aibotstoragearg.blob.core.windows.net/img-aitour/bot-avatar_.png";
            galleryCard.Description = cardResult.Description;

            var listActions = GetListActions(cardResult.Options);

            galleryCard.Actions.AddRange(listActions);

            return(galleryCard);
        }
Beispiel #2
0
        public WelcomeCard GetWelcomeCard()
        {
            var randomizer = new Random();

            OptionCardModel cardResult = (from opt in _db.Options
                                          where opt.Type == "WELCOME"
                                          let rand = randomizer.Next()
                                                     orderby rand
                                                     select new OptionCardModel()
            {
                Title = opt.Title,
                Description = opt.Body,
                OptionId = opt.OptionId,
                ParentOptionId = opt.ParentOptionId,
                Result = opt.Result,
                Options = (from opt2 in _db.Options where opt2.ParentOptionId == opt.OptionId select opt2).ToList()
            }).Take(1).SingleOrDefault();

            var welcomeCard = new WelcomeCard();

            welcomeCard.BotName     = "Botty";
            welcomeCard.Title       = cardResult.Title;
            welcomeCard.UrlImage    = "https://aibotstoragearg.blob.core.windows.net/img-aitour/bot-avatar_.png";
            welcomeCard.Description = cardResult.Description;

            var listActions = GetListActions(cardResult.Options);

            welcomeCard.Actions.AddRange(listActions);

            return(welcomeCard);
        }