Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<VideoObject> videoListRange = null;
- if (startindex != 0) startindex++;
- searchterm = searchterm.ToLower();
- var content = new VideoRetriever();
- var videoListTemp = content.GetAllVideos();
- if (videoListTemp != null && videoListTemp.Count != 0)
- {
- //filter list
- videoListTemp = videoListTemp.Where(i => i.Video.Title.ToLower().Contains(searchterm) || (!string.IsNullOrEmpty(i.Video.Description) && i.Video.Description.ToLower().Contains(searchterm))).ToList();
- var videoList = new List<VideoObject>();
- foreach (var item in videoListTemp)
- {
- videoList.Add(item.Video);
- }
- if (videoList != null && videoList.Count != 0 && videoList[startindex] != null)
- {
- var count = Convert.ToInt32(CommonHelper.AppSetting("VideoDynamicLoadCount"));
- if (videoList.Count < startindex + count)
- count = videoList.Count - startindex;
- videoListRange = videoList.GetRange(startindex, count);
- //adjust return properties
- for (int i = 0; i < videoListRange.Count; i++)
- {
- videoListRange[i].Playlist = null;
- videoListRange[i].Featured = null;
- videoListRange[i].Description = null;
- videoListRange[i].Tag = null;
- videoListRange[i].Url = null;
- videoListRange[i].YouTubeId = null;
- videoListRange[i].Index = startindex + i;
- }
- }
- }
- return videoListRange;
Add Comment
Please, Sign In to add comment