Exemple #1
0
        private ActionResult GetListView(int?page)
        {
            var currentPageIndex = page.HasValue ? page.Value - 1 : 0;

            _songRepository.SetPaginationParams(currentPageIndex, DEFAULT_PAGE_SIZE);

            var songCount = 0L;
            ReadOnlyCollection <Song> songs = null;

            switch (RouteData.Values["action"] as string)
            {
            case "Index":
                songCount = _songRepository.CountUserSongs(Config.MainAdminId);
                songs     = _songRepository.GetUserSongs(Config.MainAdminId, true);
                break;

            case "List":
                songCount = _songRepository.CountAllSongs(Config.MainAdminId);
                songs     = _songRepository.GetAllSongs(Config.MainAdminId, true);
                break;

            case "ByUser":
                songCount = _songRepository.CountUserSongs(_userId);
                songs     = _songRepository.GetUserSongs(_userId, true);
                break;

            case "ByDeletedUsers":
                songCount = _songRepository.CountSongsByDeletedUsers();
                songs     = _songRepository.GetSongsByDeletedUsers(true);
                break;
            }

            return(View(RouteData.Values["action"] as string, songs.ToPagedList(currentPageIndex, DEFAULT_PAGE_SIZE, songCount)));
        }