Beispiel #1
0
        // GET: Artist
        public ActionResult Index(string name)
        {
            var artist = artistService.GetArtistById(name);
            var model  = new ArtistViewModel()
            {
                ArtistName = artist.ArtistName,
                Biography  = artist.Biography,
                Songs      = new List <SongViewModel>(),
                Albums     = artistService.getAllAlbumsByArtist(artist.Id.ToString()).Select(a => new AlbumLink()
                {
                    Name = a.AlbumName, Link = Url.Action("Album", "Artist", new { @id = a.Id })
                }).ToList(),
                ImageUrl  = artist.Picture,
                Playlists = plRepo.GetByUser(userService.User).Select(pl => new SelectListItem()
                {
                    Text = pl.PlaylistName, Value = pl.PlaylistId.ToString()
                }).ToList()
            };

            return(View(model));
        }