Ejemplo n.º 1
0
        public ActionResult Entries(int page = 1)
        {
            var pageIndex = page - 1;
            var result    = Service.GetActivityEntries(PagingProperties.CreateFromPage(pageIndex, entriesPerPage, false));

            return(PartialView("ActivityEntryContracts", result.Items));
        }
Ejemplo n.º 2
0
        public PartialViewResult AlbumsPaged(int id, int?page)
        {
            var pageIndex   = (page - 1) ?? 0;
            var queryParams = new AlbumQueryParams {
                Paging   = PagingProperties.CreateFromPage(pageIndex, entriesPerPage, true),
                SortRule = AlbumSortRule.Name,
                ArtistId = id
            };
            var result = Services.Albums.Find(queryParams);
            var data   = new PagingData <AlbumContract>(result.Items.ToPagedList(pageIndex, entriesPerPage, result.TotalCount), id, "AlbumsPaged", "ui-tabs-2");

            return(PartialView("PagedAlbums", data));
        }
Ejemplo n.º 3
0
        public PartialViewResult SongsPaged(int id = invalidId, int?page = null)
        {
            var pageIndex   = (page - 1) ?? 0;
            var queryParams = new SongQueryParams {
                Paging   = PagingProperties.CreateFromPage(pageIndex, entriesPerPage, true),
                SortRule = SongSortRule.Name,
                ArtistId = id
            };
            var result = Services.Songs.Find(queryParams);

            var data = new PagingData <SongContract>(result.Items.ToPagedList(pageIndex, entriesPerPage, result.TotalCount), id, "SongsPaged", "ui-tabs-3");

            return(PartialView("PagedSongs", data));
        }
Ejemplo n.º 4
0
        public ActionResult UsersPaged(UserGroupId groupId = UserGroupId.Nothing, string name = "", UserSortRule sortRule = UserSortRule.RegisterDate, int totalCount = 0, int page = 1)
        {
            var pageIndex = page - 1;
            var result    = Service.GetUsers(groupId, name, sortRule, PagingProperties.CreateFromPage(pageIndex, usersPerPage, false));
            var data      = new PagingData <UserContract>(result.Items.ToPagedList(pageIndex, usersPerPage, totalCount), null, "Index", "usersList");

            data.RouteValues = new RouteValueDictionary(new { groupId, sortRule, totalCount, action = "Index" });

            if (Request.IsAjaxRequest())
            {
                return(PartialView("PagedUsers", data));
            }
            else
            {
                return(View("PagedUsers", data));
            }
        }
Ejemplo n.º 5
0
        public ActionResult FavoriteSongsPaged(int id, int?page, SongVoteRating?rating = null, SongSortRule sort = SongSortRule.Name, bool groupByRating = true)
        {
            const int songsPerPage = 50;

            var pageIndex   = (page - 1) ?? 0;
            var r           = rating ?? SongVoteRating.Nothing;
            var queryParams = new RatedSongQueryParams(id, PagingProperties.CreateFromPage(pageIndex, songsPerPage, true))
            {
                FilterByRating = r, SortRule = sort, GroupByRating = groupByRating
            };
            var result = Service.GetFavoriteSongs(queryParams);
            var data   = new PagingData <FavoriteSongForUserContract>(result.Items.ToPagedList(pageIndex, songsPerPage, result.TotalCount), id, "FavoriteSongs", "ui-tabs-3");

            data.RouteValues = new RouteValueDictionary(new { action = "FavoriteSongs", id, rating, sort, groupByRating });

            return(PartialView("FavoriteSongsPaged", data));
        }
Ejemplo n.º 6
0
        //
        // GET: /User/

        public ActionResult Index(Index model, UserSortRule?sort = null, int totalCount = 0, int page = 1)
        {
            if (Request.IsAjaxRequest())
            {
                return(UsersPaged(model.GroupId, model.Name, sort ?? UserSortRule.RegisterDate, totalCount, page));
            }

            var pageIndex = page - 1;
            var groupId   = model.GroupId;
            var sortRule  = sort ?? UserSortRule.RegisterDate;

            var result = Service.GetUsers(groupId, model.Name, sortRule, PagingProperties.CreateFromPage(pageIndex, usersPerPage, true));
            var data   = new PagingData <UserContract>(result.Items.ToPagedList(pageIndex, usersPerPage, result.TotalCount), null, "Index", "usersList");

            data.RouteValues = new RouteValueDictionary(new { groupId, name = model.Name, sortRule, totalCount = result.TotalCount, action = "Index" });

            return(View(new Index(data, groupId, model.Name)));
        }
Ejemplo n.º 7
0
        public PartialViewResult AlbumsPaged(int id, ArtistAlbumParticipationStatus?artistParticipation, int?page)
        {
            var pageIndex   = (page - 1) ?? 0;
            var queryParams = new AlbumQueryParams {
                Paging   = PagingProperties.CreateFromPage(pageIndex, entriesPerPage, true),
                SortRule = AlbumSortRule.ReleaseDateWithNulls,
                ArtistId = id,
                ArtistParticipationStatus = artistParticipation ?? ArtistAlbumParticipationStatus.Everything
            };

            var result = Services.Albums.Find(queryParams);

            var target = queryParams.ArtistParticipationStatus == ArtistAlbumParticipationStatus.OnlyCollaborations ? "ui-tabs-3" : "ui-tabs-2";
            var data   = new PagingData <AlbumContract>(result.Items.ToPagedList(pageIndex, entriesPerPage, result.TotalCount), id, "AlbumsPaged", target);

            data.RouteValues = new RouteValueDictionary(new { artistParticipation });

            return(PartialView("PagedAlbums", data));
        }
Ejemplo n.º 8
0
        public ActionResult AlbumCollectionPaged(AlbumCollectionRouteParams routeParams)
        {
            var id = routeParams.id;

            if (id == invalidId)
            {
                return(NoId());
            }

            const int entriesPerPage = 50;
            var       pageIndex      = (routeParams.page - 1) ?? 0;
            var       queryParams    = new AlbumCollectionQueryParams(id, PagingProperties.CreateFromPage(pageIndex, entriesPerPage, routeParams.count == 0))
            {
                FilterByStatus = routeParams.purchaseStatus ?? PurchaseStatus.Nothing
            };
            var albums = Service.GetAlbumCollection(queryParams);

            routeParams.count = (albums.TotalCount != 0 ? albums.TotalCount : routeParams.count);
            var paged = new PagingData <AlbumForUserContract>(albums.Items.ToPagedList(pageIndex, entriesPerPage, routeParams.count), id, "AlbumCollection", "ui-tabs-1");

            paged.RouteValues = new RouteValueDictionary(new { action = "AlbumCollection", id, count = routeParams.count, purchaseStatus = routeParams.purchaseStatus });

            return(PartialView("AlbumCollectionPaged", paged));
        }
Ejemplo n.º 9
0
        public ActionResult AlbumCollectionPaged(AlbumCollectionRouteParams routeParams)
        {
            var id = routeParams.id;

            if (id == invalidId)
            {
                return(NoId());
            }

            int pageSize    = Math.Min(routeParams.pageSize ?? 50, 200);
            var pageIndex   = (routeParams.page - 1) ?? 0;
            var queryParams = new AlbumCollectionQueryParams(id, PagingProperties.CreateFromPage(pageIndex, pageSize, routeParams.totalCount == 0))
            {
                FilterByStatus = routeParams.purchaseStatus != null ? new[] { routeParams.purchaseStatus.Value } : null
            };
            var albums = Data.GetAlbumCollection(queryParams);

            routeParams.totalCount = (albums.TotalCount != 0 ? albums.TotalCount : routeParams.totalCount);
            var paged = new PagingData <AlbumForUserContract>(albums.Items.ToPagedList(pageIndex, pageSize, routeParams.totalCount), id, "AlbumCollection", "ui-tabs-1", addTotalCount: true);

            paged.RouteValues = new RouteValueDictionary(new { routeParams.purchaseStatus, pageSize });

            return(PartialView("AlbumCollectionPaged", paged));
        }
Ejemplo n.º 10
0
        //
        // GET: /User/

        public ActionResult Index(Index model, string filter = null, UserSortRule?sort = null, int totalCount = 0, int page = 1)
        {
            if (!string.IsNullOrEmpty(filter) && string.IsNullOrEmpty(model.Name))
            {
                model.Name = filter;
            }

            if (Request.IsAjaxRequest())
            {
                return(UsersPaged(model.GroupId, model.Name, model.Disabled, model.VerifiedArtists, sort ?? UserSortRule.RegisterDate, totalCount, page));
            }

            var pageIndex = page - 1;
            var groupId   = model.GroupId;
            var sortRule  = sort ?? UserSortRule.RegisterDate;

            var result = Data.GetUsers(groupId, model.Name, model.Disabled, model.VerifiedArtists, sortRule, PagingProperties.CreateFromPage(pageIndex, usersPerPage, true));

            if (page == 1 && result.TotalCount == 1 && result.Items.Length == 1)
            {
                return(RedirectToAction("Profile", new { id = result.Items[0].Name }));
            }

            var data = new PagingData <UserContract>(result.Items.ToPagedList(pageIndex, usersPerPage, result.TotalCount), null, "Index", "usersList");

            data.RouteValues = new RouteValueDictionary(new { groupId, name = model.Name, disabled = model.Disabled, sortRule, totalCount = result.TotalCount, action = "Index" });

            return(View(new Index(data, groupId, model.Name, model.VerifiedArtists)));
        }