예제 #1
0
        public async Task <ActionResult> ArchiveBy(string archiveBy, int?page)
        {
            if (string.IsNullOrEmpty(archiveBy))
            {
                return(View("ResourceNotFound"));
            }

            ConcreteVideoArchiveFactory factory = new ConcreteVideoArchiveFactory(_uow);
            IVideoArchive videoArchive          = factory.GetVideoArchive(archiveBy);

            var videoArchiveList = await videoArchive.GetArchiveAsync(page ?? 1, 30);

            ViewData["archiveBy"] = archiveBy;

            ArchiveByViewModel viewModel = new ArchiveByViewModel(videoArchiveList, videoArchiveList.Count, page ?? 1, 30);

            return(View(viewModel));
        }
        public override IVideoArchive GetVideoArchive(string archiveBy)
        {
            switch (archiveBy)
            {
            case "disapproved-videos":
                _videoArchive = new DisapprovedVideosManager(UnitOfWork);
                break;

            case "pending-approvals":
                _videoArchive = new PendingApprovalsManager(UnitOfWork);
                break;

            default:
                _videoArchive = new ApprovedVideosManager(UnitOfWork);
                break;
            }
            return(_videoArchive);
        }