public async Task <ActionResult> Media(MediaIndexModel model)
        {
            await SearchMediaAsync(model);
            await PopulateMediaPageAsync(model);

            return(PartialView("Media/_MediaResult", model));
        }
        public async Task <ActionResult> GetMediaPopup(MediaIndexModel model)
        {
            await SearchMediaAsync(model);
            await PopulateMediaPageAsync(model);

            model.Paging.CalculatePaging();

            return(PartialView("Media/_MediaItems", model));
        }
        public async Task <ActionResult> Media()
        {
            var model = new MediaIndexModel();

            await SearchMediaAsync(model);
            await PopulateMediaPageAsync(model);

            SetTitle("Quản Lý Thư Viện");
            return(View(model));
        }
        private async Task SearchMediaAsync(MediaIndexModel model)
        {
            var response = await _mediaService.FindAsync(new MediaFindRequest
            {
                Type       = (int?)model.Type,
                Name       = model.Name,
                PageSize   = model.Paging.PageSize,
                PageNumber = model.Paging.PageNumber,
                Sort       = model.Sort
            });

            model.Results             = _mapper.Map <List <MediaModel> >(response.Results);
            model.Paging.TotalRecords = response.TotalRecords;
        }
        public async Task <ActionResult> GetMediaPopup(MediaType?type)
        {
            var model = new MediaIndexModel
            {
                Type = type
            };

            model.Paging.PageSize = 20;

            await SearchMediaAsync(model);
            await PopulateMediaPageAsync(model);

            model.Paging.CalculatePaging();

            return(PartialView("Media/_MediaPopup", model));
        }
Exemplo n.º 6
0
        public IActionResult Index(string search = null)
        {
            if (!string.IsNullOrEmpty(search))
            {
                var foundMedia   = _assets.SearchMedia(search);
                var foundListing = foundMedia.Select(r => new MediaIndexListingModel
                {
                    Id      = r.MediaId,
                    Author  = _assets.getAuthorOrDirector(r.MediaId),
                    Genre   = _assets.getGenre(r.MediaId),
                    CallNum = _assets.getCallNum(r.MediaId),
                    Title   = r.Title,
                    Type    = _assets.getMediaType(r.MediaId)
                });

                var model1 = new MediaIndexModel()
                {
                    Assets = foundListing
                };
                return(View(model1));
            }
            var assetModels   = _assets.getAll();
            var listingResult = assetModels.Select(result => new MediaIndexListingModel
            {
                Id      = result.MediaId,
                Author  = _assets.getAuthorOrDirector(result.MediaId),
                Genre   = _assets.getGenre(result.MediaId),
                CallNum = _assets.getCallNum(result.MediaId),
                Title   = result.Title,
                Type    = _assets.getMediaType(result.MediaId)
            });

            var model = new MediaIndexModel()
            {
                Assets = listingResult
            };

            return(View(model));
        }
 private async Task PopulateMediaPageAsync(MediaIndexModel model)
 {
     model.Paging.PageClickFunction = "comdy.media.search({0})";
     model.PopulateCreatedUser(await _userService.GetReferencesAsync());
 }