Esempio n. 1
0
        /// <summary>
        /// 获取用户播放历史
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public AppChoicenesssView GetUserHistories(int userId, int pageIndex, int pageSize)
        {
            var choicenesss = new AppChoicenesssView {
                Choiceness = new List <AppChoicenessView>()
            };
            var userHistories    = _userHistoryRepository.GetEntityList(CondtionEqualUserId(userId));
            var choicenessVideos = (
                from uh in userHistories
                join v in _videoRepository.GetEntityList(CondtionEqualState()) on uh.VideoId equals v.Id
                join u in _userRepository.GetEntityList(CondtionEqualState()) on uh.UserId equals u.Id
                where v.VideoSource && v.VideoState == 3
                orderby uh.CreateTime descending
                select new AppChoicenessView
            {
                IsSubed = IsSubed(_userFansRepository.GetEntityList(), u.Id, userId),
                IsCollect = IsCollect(_userCollectRepository.GetEntityList(), (int)v.Id, userId),
                UserInfo = UserEasyView(u),
                VideoInfo = VideoView(v),
                Comments = ParentComments((int)v.Id)
            });

            choicenesss.Choiceness = PageList(choicenessVideos, pageSize, pageIndex);
            return(choicenesss);
        }