public MarkRepository(PlayerContext context) { this.db = context; }
public PlaylistVideoRepository(PlayerContext context) { }
public SubscriptionRepository(PlayerContext context) { }
public UserRepository(PlayerContext context) { }
/// <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); } }
public WatchLaterRepository(PlayerContext context) { }
public VideoRepository(PlayerContext context) { }
public NotificationRepository(PlayerContext context) { }
public CommentRepostiroty(PlayerContext context) { this.db = context; }