//[Route("GetLatestAlbums/{currentPageNumber}/{numberOfRecordsPerPage}/{categoryNameForFilter}")] public businessModels.ScrollableAlbums GetAllAlbums(int currentPageNumber, int numberOfRecordsPerPage, string categoryNameForFilter = "") { var numberOfRecordsToSkip = (currentPageNumber - 1) * numberOfRecordsPerPage; var filteredByCategoryNameAlbums = albumRepository.GetAllByCategoryName(categoryNameForFilter); var filteredAlbumsModel = new businessModels.ScrollableAlbums(); filteredAlbumsModel.AlbumsToShow = filteredByCategoryNameAlbums .OrderBy(orderingAlbum => orderingAlbum.ModificationDate) .Skip(numberOfRecordsToSkip) .Take(numberOfRecordsPerPage) .ToList() .Select(album => Mapper.Map<businessModels.Album>(album)).ToList(); filteredAlbumsModel.TotalAlbumsCount = filteredByCategoryNameAlbums.Count(); return filteredAlbumsModel; }
//[Route("GetLatestAlbums/{currentPageNumber}/{numberOfRecordsPerPage}/{categoryNameForFilter}")] public businessModels.ScrollableAlbums GetAllAlbums(int currentPageNumber, int numberOfRecordsPerPage, string categoryNameForFilter = "") { var numberOfRecordsToSkip = (currentPageNumber - 1) * numberOfRecordsPerPage; var filteredByCategoryNameAlbums = albumRepository.GetAllByCategoryName(categoryNameForFilter); var filteredAlbumsModel = new businessModels.ScrollableAlbums(); filteredAlbumsModel.AlbumsToShow = filteredByCategoryNameAlbums .OrderBy(orderingAlbum => orderingAlbum.ModificationDate) .Skip(numberOfRecordsToSkip) .Take(numberOfRecordsPerPage) .ToList() .Select(album => Mapper.Map <businessModels.Album>(album)).ToList(); filteredAlbumsModel.TotalAlbumsCount = filteredByCategoryNameAlbums.Count(); return(filteredAlbumsModel); }