Ejemplo n.º 1
0
 public MarkRepository(PlayerContext context)
 {
     this.db = context;
 }
Ejemplo n.º 2
0
 public PlaylistVideoRepository(PlayerContext context)
 {
 }
Ejemplo n.º 3
0
 public SubscriptionRepository(PlayerContext context)
 {
 }
Ejemplo n.º 4
0
 public UserRepository(PlayerContext context)
 {
 }
Ejemplo n.º 5
0
        /// <summary>
        ///  Gets range of video start from (pageCount-1)*numberOfItems order by state, count Videos
        /// </summary>
        /// <param name="pageCount"></param>
        /// <param name="numberOfItems"></param>
        /// <param name="state"></param>
        /// <param name="searchString"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public IEnumerable <Video> GetVideoByRange(int pageCount, int numberOfItems, SortState state, string searchString, int UserId, out int count)
        {
            using (PlayerContext db = new PlayerContext())
            {
                int skip = (pageCount - 1) * numberOfItems;
                IEnumerable <Video> videos = null;
                count = db.WatchLaters.AsNoTracking().Include(x => x.Video).Where(x => x.Video.Name.Contains(searchString) && x.UserId == UserId).Count();
                switch (state)
                {
                case SortState.New:
                {
                    var temp = db.WatchLaters
                               .Where(x => x.Video.Name.Contains(searchString) && x.UserId == UserId)
                               .OrderByDescending(x => x.Video.UploadDate)
                               .Skip(skip).Take(numberOfItems).Select(x => x.Video).ToList();
                    foreach (var item in temp)
                    {
                        db.Entry(item).Reference("User").Load();
                    }
                    videos = temp;
                    break;
                }

                case SortState.Old:
                {
                    var temp = db.WatchLaters
                               .Where(x => x.Video.Name.Contains(searchString) && x.UserId == UserId)
                               .OrderBy(x => x.Video.UploadDate)
                               .Skip(skip).Take(numberOfItems).Select(x => x.Video).ToList();
                    foreach (var item in temp)
                    {
                        db.Entry(item).Reference("User").Load();
                    }
                    videos = temp;
                    break;
                }

                case SortState.Long:
                {
                    var temp = db.WatchLaters
                               .Where(x => x.Video.Name.Contains(searchString) && x.UserId == UserId)
                               .OrderByDescending(x => x.Video.MaxDuration)
                               .Skip(skip).Take(numberOfItems).Select(x => x.Video).ToList();
                    foreach (var item in temp)
                    {
                        db.Entry(item).Reference("User").Load();
                    }
                    videos = temp;
                    break;
                }

                case SortState.Short:
                {
                    var temp = db.WatchLaters
                               .Where(x => x.Video.Name.Contains(searchString) && x.UserId == UserId)
                               .OrderBy(x => x.Video.MaxDuration)
                               .Skip(skip).Take(numberOfItems).Select(x => x.Video).ToList();
                    foreach (var item in temp)
                    {
                        db.Entry(item).Reference("User").Load();
                    }
                    videos = temp;
                    break;
                }
                }
                return(videos);
            }
        }
Ejemplo n.º 6
0
 public WatchLaterRepository(PlayerContext context)
 {
 }
Ejemplo n.º 7
0
 public VideoRepository(PlayerContext context)
 {
 }
Ejemplo n.º 8
0
 public NotificationRepository(PlayerContext context)
 {
 }
Ejemplo n.º 9
0
 public CommentRepostiroty(PlayerContext context)
 {
     this.db = context;
 }