Guest User

Untitled

a guest
Feb 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 KB | None | 0 0
  1. List<VideoObject> videoListRange = null;
  2.  
  3.         if (startindex != 0) startindex++;
  4.         searchterm = searchterm.ToLower();
  5.  
  6.         var content = new VideoRetriever();
  7.         var videoListTemp = content.GetAllVideos();
  8.  
  9.         if (videoListTemp != null && videoListTemp.Count != 0)
  10.         {
  11.             //filter list
  12.             videoListTemp = videoListTemp.Where(i => i.Video.Title.ToLower().Contains(searchterm) || (!string.IsNullOrEmpty(i.Video.Description) && i.Video.Description.ToLower().Contains(searchterm))).ToList();
  13.  
  14.             var videoList = new List<VideoObject>();
  15.             foreach (var item in videoListTemp)
  16.             {
  17.                 videoList.Add(item.Video);
  18.             }
  19.  
  20.             if (videoList != null && videoList.Count != 0 && videoList[startindex] != null)
  21.             {
  22.                 var count = Convert.ToInt32(CommonHelper.AppSetting("VideoDynamicLoadCount"));
  23.  
  24.                 if (videoList.Count < startindex + count)
  25.                     count = videoList.Count - startindex;
  26.  
  27.                 videoListRange = videoList.GetRange(startindex, count);
  28.  
  29.                 //adjust return properties
  30.                 for (int i = 0; i < videoListRange.Count; i++)
  31.                 {
  32.                     videoListRange[i].Playlist = null;
  33.                     videoListRange[i].Featured = null;
  34.                     videoListRange[i].Description = null;
  35.                     videoListRange[i].Tag = null;
  36.                     videoListRange[i].Url = null;
  37.                     videoListRange[i].YouTubeId = null;
  38.                     videoListRange[i].Index = startindex + i;
  39.                 }
  40.             }
  41.         }
  42.  
  43.         return videoListRange;
Add Comment
Please, Sign In to add comment