public async Task <ActionResult> Gallery(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Album album = ctx.Albums.Find(id); if (album == null) { return(HttpNotFound()); } ViewAlbum viewAlbum = new ViewAlbum { Name = album.Name, Date = album.Date, IDA = album.ID, User = album.User.Name, IDU = album.User.ID, Comment = album.Comment, URLpath = album.ThumbnailURL, Count = album.Pictures.Count }; ViewBag.Album = viewAlbum; List <Picture> pictures = album.Pictures.ToList(); return(PartialView(pictures)); }
public ViewAlbum Album(string link) { var al = repo.getAlbum(link); List <KeyValuePair <string, string> > artists = al.Artists.Select(a => new KeyValuePair <string, string>(simpleHref(a.Link), a.Name)).ToList(); List <KeyValuePair <string, string> > tracks = al.Tracks.Select(t => new KeyValuePair <string, string>(simpleHref(t.Link), t.Name)).ToList(); var val = new ViewAlbum(simpleHref(al.Link), al.Name, (int)al.Year, artists, tracks); return(val); }
public ActionResult AlbumGet(string href) { ViewAlbum album = Rules.Find.Album(href); if (album == null) { return(new HttpStatusCodeResult(504)); } return(View(album)); }
public AlbumView(ViewAlbum album) : base(album.Name, H1(Text(string.Format("Album : {0}", album.Name))), P(Label("name", "Name"), Text(album.Name)), P(Label("year", "Release"), Text(album.Year)), H2(Text("Artists")), Ul( album.Artist.Select(a => Li(A(ResolveUri.ForArtist(a.Key), a.Value))).ToArray() ), H2(Text("Tracks")), Ul( album.Tracks.Select(trc => Li(A(ResolveUri.ForTrack(trc.Key), trc.Value))).ToArray() ), PlaylistPlayer(album.Name, album.Tracks.Select(track => track.Key).ToArray()), Ul( Li(A(ResolveUri.ForPlaylist(), "Playlists")), Li(A(ResolveUri.ForSearch(), "Search")) ) ) { }
public static string For(ViewAlbum alb) { return(string.Format("/album/{0}", alb.Href)); }