Esempio n. 1
0
        public async Task <IActionResult> UnapprovedSongs(int page = 1)
        {
            GetUnapprovedSongs getSongsQuery = new GetUnapprovedSongs()
            {
                PageInfo = new PageInfo(page, DefaultPageSize)
            };

            IEnumerable <Song> unapprovedSongs = await this.getUnapprovedSongs.ExecuteAsync(getSongsQuery);

            GetSongsCount getSongsCountQuery = new GetSongsCount()
            {
                Approved   = false,
                SearchInfo = new SearchInfo(null)
            };

            int songsCount = await this.getSongsCount.ExecuteAsync(getSongsCountQuery);

            IEnumerable <SongListingViewModel> songsModel =
                Mapper.Map <IEnumerable <SongListingViewModel> >(unapprovedSongs);

            PaginatedViewModel <SongListingViewModel> model =
                ViewModelFactory.CreatePaginatedViewModel <SongListingViewModel>(
                    songsModel,
                    page,
                    DefaultPageSize,
                    songsCount);

            return(View(model));
        }