Example #1
0
        private StandardVideos GetVideosForStandard(string code)
        {
            var res = new StandardVideos
            {
                StandardName = code,
                Videos       = YoutubeConnector.Search(code, 20).ToList()
            };

            return(res);
        }
Example #2
0
        public ActionResult Edit(string query, int announcementApplicationId)
        {
            var model = new SearchModel();

            model.Query = query;
            if (string.IsNullOrEmpty(query))
            {
                var chalkableConnector = new ChalkableConnector(OauthClient);
                var anap = chalkableConnector.GetAnnouncementApplicationById(announcementApplicationId);
                var ann  = chalkableConnector.GetAnnouncemnetById(anap.data.announcementid);
                query = [email protected];
            }
            var connector = new YoutubeConnector();
            var videos    = connector.Search(query);

            model.Videos = videos.Select(VideoModel.Create);
            model.AnnouncementApplicationId = announcementApplicationId;

            return(View("Edit", model));
        }
Example #3
0
        protected override PaginatedList <ApplicationContent> GetApplicationContents(IList <StandardInfo> standardInfos, int?start, int?count)
        {
            count = count ?? 5;
            start = start ?? 0;

            var ids              = standardInfos.Select(x => x.StandardId).JoinString(",");
            var chlkConnector    = new ChalkableConnector(ChalkableAuthorization);
            var youtubeConnector = new YoutubeConnector();

            var standards = YoutubeController.GetStandardCodes(ids, chlkConnector);
            var videos    = standards.SelectMany(x => youtubeConnector.Search(x, 5))
                            .Select(x => new ApplicationContent
            {
                ContentId   = x.Id,
                Description = x.ShortDescription,
                ImageUrl    = x.ThumbUrl,
                Text        = x.ShortTitle
            }).ToList();

            return(new PaginatedList <ApplicationContent>(videos.Take(count.Value), videos.Count));
        }
Example #4
0
        public ActionResult SearchVideos(string searchQuery)
        {
            var videos = YoutubeConnector.Search(searchQuery);

            return(ChlkJson(videos));
        }