public ActionResult Index(VideoViewhelper VideoViewhelper)
 {
     if (Session.getCurrentUser() == null)
         return Redirect("/admin/account/logon");
     if (!SercurityServices.HasPermission((int)TypeModule.MODULE_MEDIA, Session.getCurrentUser().username, TypeAudit.Video))
     {
         return Redirect("/admin/error/error403");
     }
     saveData(VideoViewhelper);
     return View();
 }
        public VideoViewhelper saveData(VideoViewhelper videoViewhelper)
        {
            List<gov_video> lstVideo = _cnttDB.gov_video.ToList() ;
            lstVideo = setSearchFilter(lstVideo, videoViewhelper);

            int totalCount = lstVideo.Count;
            videoViewhelper.TotalCount = totalCount;

            if (videoViewhelper.TotalCount > 0)
            {
                int totalPage = pageCalculation(totalCount, Constant.limit);
                videoViewhelper.TotalPage = totalPage;
                videoViewhelper.Page = pageTransition(videoViewhelper.Direction, videoViewhelper.Page, totalPage);
                videoViewhelper.FirstPage = fistPageCalculation(Constant.maxPageLine, totalPage, videoViewhelper.Page);
                videoViewhelper.LastPage = lastPageCalculation(Constant.maxPageLine, totalPage, videoViewhelper.Page, videoViewhelper.FirstPage);
                int take = Constant.limit;
                int skip = (videoViewhelper.Page - 1) * take;
                lstVideo = lstVideo.OrderByDescending(v => v.entry_datetime).Take(take).Skip(skip).ToList();
                videoViewhelper.LstVideo = lstVideo;
            }
            ViewData["VideoViewhelper"] = videoViewhelper;
            return videoViewhelper;
        }
 public List<gov_video> setSearchFilter(List<gov_video> lstVideo, VideoViewhelper videoViewhelper)
 {
     Expression<Func<gov_video, bool>> predicate = PredicateBuilder.False<gov_video>();
     if (!String.IsNullOrEmpty(videoViewhelper.KeySearch))
     {
         predicate = predicate.Or(d => d.title.ToUpper().Contains(videoViewhelper.KeySearch.ToUpper()));
         predicate = predicate.Or(d => d.description.ToUpper().Contains(videoViewhelper.KeySearch.ToUpper()));
         predicate = predicate.Or(d => d.update_username.ToUpper().Contains(videoViewhelper.KeySearch.ToUpper()));
         lstVideo = lstVideo.Where(predicate.Compile()).ToList();
     }
     return lstVideo;
 }