// GET: /Admin/Album
        public ActionResult Index()
        {
            var response = _albumService.GetAllAlbums();

            var model = new IndexAlbumViewModel
            {
                Albums = response.Albums.OrderBy(a => a.Genre.Name).ThenBy(a => a.Artist.Name).ThenBy(a => a.Title)
            };

            return(View(model));
        }
示例#2
0
        /// <summary>
        /// Displays a page with detailed info about the Album the User has clicked on.
        /// </summary>
        /// <returns>Rendered view to the response.</returns>
        //[Route("Album/{id}")]
        public IActionResult AlbumInfo(int albumId)
        {
            var viewModel = new IndexAlbumViewModel();

            var a = albumService.GetAll().FirstOrDefault(x => x.AlbumId == albumId);

            viewModel.Artist     = a.Artist;
            viewModel.GenreId    = a.GenreId;
            viewModel.Genre      = genreService.GetAll().FirstOrDefault(x => x.Id == a.GenreId).Name;
            viewModel.Title      = a.Title;
            viewModel.Year       = a.Year;
            viewModel.TimesRated = a.TimesRated;

            return(this.View(viewModel));
        }