Exemplo n.º 1
0
        public IActionResult Index(int artistId, int albumId)
        {
            var artistInfoModel = _artist.Get(artistId);
            var albumModel      = _albumSong.GetAlbumByArtist(albumId);

            var album = new AlbumListingModel
            {
                Id         = albumModel.Album.Id,
                Name       = albumModel.Album.Name,
                YrReleased = albumModel.Album.YrReleased
            };

            var artistInfo = new ArtistListingModel
            {
                Id           = artistInfoModel.Id,
                ArtistName   = artistInfoModel.ArtistName,
                Bio          = artistInfoModel.Bio,
                YrFormed     = artistInfoModel.YrFormed,
                YrEnded      = artistInfoModel.YrEnded,
                isActive     = artistInfoModel.isActive,
                HomeCountry  = artistInfoModel.HomeCountry,
                HomeTown     = artistInfoModel.HomeTown,
                PrimaryImage = _image.GetPrimaryImageByEntity(2, artistInfoModel.Id, 2)
            };

            var model = new AlbumPostIndexModel
            {
                Artist = artistInfo,
                Album  = album
            };

            return(View(model));
        }
        public IActionResult Index(int id)
        {
            var artistInfoModel   = _artist.Get(id);
            var musicianListModel = _artistMusician.GetAllByArtist(id);

            var artistInfo = new ArtistListingModel
            {
                Id           = id,
                ArtistName   = artistInfoModel.ArtistName,
                Bio          = artistInfoModel.Bio,
                YrFormed     = artistInfoModel.YrFormed,
                YrEnded      = artistInfoModel.YrEnded,
                isActive     = artistInfoModel.isActive,
                HomeCountry  = artistInfoModel.HomeCountry,
                HomeTown     = artistInfoModel.HomeTown,
                PrimaryImage = _image.GetPrimaryImageByEntity(2, artistInfoModel.Id, 2)
            };

            //existing musicians
            var musicians = musicianListModel.Select
                                (r => new MusicianListingModel
            {
                Id           = r.Musician.Id,
                Bio          = r.Musician.Bio,
                Birth        = r.Musician.Birth,
                Death        = r.Musician.Death,
                FirstName    = r.Musician.FirstName,
                LastName     = r.Musician.LastName,
                MusicianName = r.Musician.MusicianName,
                HomeCountry  = r.Musician.HomeCountry,
                HomeTown     = r.Musician.HomeTown,
                isActive     = r.Musician.isActive,
                PrimaryImage = _image.GetPrimaryImageByEntity(5, r.Musician.Id, 1)
            }
                                ).ToList();

            //new musician
            var musician = new MusicianListingModel
            {
                Id           = 0,
                MusicianName = string.Empty,
                LastName     = string.Empty,
                FirstName    = string.Empty,
                Bio          = string.Empty,
                Birth        = DateTime.Now,
                Death        = DateTime.Now,
                isActive     = 0,
                HomeTown     = string.Empty,
                HomeCountry  = string.Empty
            };

            var model = new MusicianPostIndexModel
            {
                Artist    = artistInfo,
                Musicians = musicians,
                Musician  = musician
            };

            return(View(model));
        }
Exemplo n.º 3
0
        public IActionResult Index(int id)
        {
            var artistInfoModel = _artist.Get(id);

            //empty album object
            var album = new AlbumListingModel
            {
                Id         = 0,
                Name       = string.Empty,
                YrReleased = 0
            };

            var artistInfo = new ArtistListingModel
            {
                Id           = artistInfoModel.Id,
                ArtistName   = artistInfoModel.ArtistName,
                Bio          = artistInfoModel.Bio,
                YrFormed     = artistInfoModel.YrFormed,
                YrEnded      = artistInfoModel.YrEnded,
                isActive     = artistInfoModel.isActive,
                HomeCountry  = artistInfoModel.HomeCountry,
                HomeTown     = artistInfoModel.HomeTown,
                PrimaryImage = _image.GetPrimaryImageByEntity(2, artistInfoModel.Id, 2)
            };

            var model = new AlbumPostIndexModel
            {
                Artist = artistInfo,
                Album  = album
            };

            return(View(model));
        }
Exemplo n.º 4
0
        public IActionResult Index(int id)
        {
            var artistInfoModel = _artist.Get(id);
            var musicianModel   = _artistMusician.GetAllByArtist(id);

            var artistInfo = new ArtistListingModel
            {
                Id           = artistInfoModel.Id,
                ArtistName   = artistInfoModel.ArtistName,
                Bio          = artistInfoModel.Bio,
                YrFormed     = artistInfoModel.YrFormed,
                YrEnded      = artistInfoModel.YrEnded,
                isActive     = artistInfoModel.isActive,
                HomeCountry  = artistInfoModel.HomeCountry,
                HomeTown     = artistInfoModel.HomeTown,
                PrimaryImage = _image.GetPrimaryImageByEntity(2, artistInfoModel.Id, 2)
            };

            var musicians = musicianModel.Select
                                (r => new MusicianListingModel
            {
                Id           = r.Musician.Id,
                Bio          = r.Musician.Bio,
                Birth        = r.Musician.Birth,
                Death        = r.Musician.Death,
                FirstName    = r.Musician.FirstName,
                LastName     = r.Musician.LastName,
                MusicianName = r.Musician.MusicianName,
                HomeCountry  = r.Musician.HomeCountry,
                HomeTown     = r.Musician.HomeTown,
                isActive     = r.Musician.isActive,
                PrimaryImage = _image.GetPrimaryImageByEntity(5, r.Musician.Id, 1)
            }
                                ).ToList();

            //get all genres
            var genreModel = _genre.GetAll();

            // genre list
            var genres = genreModel.Select
                             (g => new GenreListingModel
            {
                Id       = g.Id,
                Name     = g.Name,
                isMarked = _artistGenre.isMarked(g.Id, id)
            }
                             ).ToList();

            var model = new ArtistModIndexModel
            {
                Artist    = artistInfo,
                Musicians = musicians,
                Genres    = genres
            };

            return(View(model));
        }
Exemplo n.º 5
0
        public IActionResult Index()
        {
            var artistInfoModel = _artist.Get(1);
            //var musicianModel = _artistMusician.GetAllByArtist(1);
            //var musicianModel = _musician.Get(1);
            var genreModel = _genre.GetAll();

            var artistInfo = new ArtistListingModel
            {
                Id          = 0,
                ArtistName  = string.Empty,
                Bio         = string.Empty,
                YrFormed    = 0,
                YrEnded     = 0,
                isActive    = 1,
                HomeCountry = string.Empty,
                HomeTown    = string.Empty
                              //PrimaryImage = _image.GetPrimaryImageByEntity(2, artistInfoModel.Id, 2)
            };
            //var musicians = musicianModel.Select
            //   (r => new MusicianListingModel
            //   {
            //       Id = 0,
            //       Bio = string.Empty,
            //       Birth = System.DateTime.Now,
            //       Death = System.DateTime.Now,
            //       FirstName = string.Empty,
            //       LastName = string.Empty,
            //       MusicianName = string.Empty,
            //       HomeCountry = string.Empty,
            //       HomeTown = string.Empty,
            //       isActive = 1
            //       //PrimaryImage = _image.GetPrimaryImageByEntity(5, r.Musician.Id, 1)
            //   }
            //   ).ToList();

            var genres = genreModel.Select
                             (g => new GenreListingModel
            {
                Id   = g.Id,
                Name = g.Name
                       //isMarked = _artistGenre.isMarked(g.Id, id)
            }
                             ).ToList();

            var model = new ArtistPostIndexModel
            {
                Artist = artistInfo,
                //Musicians = musicians,
                Genres = genres
            };

            return(View(model));
        }
Exemplo n.º 6
0
        public IActionResult Index(int albumId, int artistId) //artistId always passed, albumId optional
        {
            var artistModel   = _artist.Get(artistId);
            var albumModel    = _albumSong.GetAllAlbumsByArtist(artistId).FirstOrDefault(); //return 1, may be 0, 1, or M.
            var songModel     = _albumSong.GetRandomSongsByArtist(artistId);                //may be 0, 1, or M.
            var allSongsModel = _albumSong.GetAllSongsByArtist(artistId);

            //var artistAlbumInfoModel = _albumSong.GetAlbumByAlbum(albumId);
            //var songModel = _albumSong.GetAllSongsByAlbum(albumId);
            if (albumId != 0)
            {
                albumModel = _albumSong.GetAlbumByAlbum(albumId);
                songModel  = _albumSong.GetAllSongsByAlbum(albumId);
            }

            //empty song object - bind to form
            var song = new SongListingModel
            {
                Id          = 0,
                Name        = string.Empty,
                Duration    = string.Empty,
                TrackNumber = 0
            };

            //all existing songs on album, if any
            var songs = songModel.Select
                            (r => new SongListingModel
            {
                Id          = r.Song.Id,
                Name        = r.Song.Name,
                Duration    = r.Song.Duration,
                TrackNumber = r.TrackNumber
                              //PrimaryImage = _image.GetPrimaryImageByEntity(1, r.Album.Id, 1)
            }
                            ).ToList();

            var album = new AlbumListingModel
            {
                Id           = albumModel.Album.Id,
                Name         = albumModel.Album.Name,
                YrReleased   = albumModel.Album.YrReleased,
                PrimaryImage = _image.GetPrimaryImageByEntity(1, albumModel.Album.Id, 1)
            };

            var artistInfo = new ArtistListingModel
            {
                Id           = artistModel.Id,
                ArtistName   = artistModel.ArtistName,
                Bio          = artistModel.Bio,
                YrFormed     = artistModel.YrFormed,
                YrEnded      = artistModel.YrEnded,
                isActive     = artistModel.isActive,
                HomeCountry  = artistModel.HomeCountry,
                HomeTown     = artistModel.HomeTown,
                PrimaryImage = _image.GetPrimaryImageByEntity(2, artistModel.Id, 2)
            };

            var model = new SongPostIndexModel
            {
                Artist = artistInfo,
                Album  = album,
                Songs  = songs,
                Song   = song
            };

            return(View(model));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Index(int artistId, MainIndexModel srch)
        {
            var url = "https://localhost:44334/api/SearchRest/searchArtistsByGenres?"; // put in appSettings
            //var url = "https://wikivox.azurewebsites.net/api/SearchRest/searchArtistsByGenres?"; // put in appSettings
            var terms = string.Empty;

            if (srch.GenreListing == null)
            {
                // default genre search
                terms = "term=1";
            }
            else
            {
                //loop thru list and obtain search terms
                foreach (var g in srch.GenreListing)
                {
                    if (g.isMarked)
                    {
                        if (terms == string.Empty)
                        {
                            terms += "term=" + g.Id;
                        }
                        else
                        {
                            terms += "&term=" + g.Id;
                        }
                    }
                }
            }

            List <Artist> artistModel = new List <Artist>();

            using (var httpClient = new HttpClient())
            {
                using (var response = await httpClient.GetAsync(url + terms))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    artistModel = JsonConvert.DeserializeObject <List <Artist> >(apiResponse);
                }
            }

            // by default, load one artist in object for launch page
            Random rnd       = new Random();
            int    artistNum = _artist.GetAll().Count();

            //var x = x - 1;

            int defaultArtistId = rnd.Next(1, artistNum - 1);
            var artistInfoModel = _artist.Get(defaultArtistId);

            // if an artist has been selected, gather details to display
            if (artistId != 0)
            {
                artistInfoModel = _artist.Get(artistId);
            }

            var genreModel       = _genre.GetAll();
            var artistGenreModel = _artistGenre.GetAll();

            // genre list
            var genres = genreModel.Select
                             (g => new GenreListingModel
            {
                Id   = g.Id,
                Name = g.Name
            }
                             ).ToList();

            // artist list
            var artists = artistModel.Select
                              (a => new ArtistListingModel
            {
                Id         = a.Id,
                ArtistName = a.ArtistName
            }
                              ).ToList();

            var artistGenres = artistGenreModel.Select
                                   (r => new ArtistGenreModel
            {
                Id     = r.Id,
                Artist = r.Artist,
                Genre  = r.Genre
            }
                                   ).ToList();

            var artistInfo = new ArtistListingModel
            {
                Id           = artistInfoModel.Id,
                ArtistName   = artistInfoModel.ArtistName,
                Bio          = artistInfoModel.Bio,
                YrFormed     = artistInfoModel.YrFormed,
                YrEnded      = artistInfoModel.YrEnded,
                isActive     = artistInfoModel.isActive,
                HomeCountry  = artistInfoModel.HomeCountry,
                HomeTown     = artistInfoModel.HomeTown,
                PrimaryImage = _image.GetPrimaryImageByEntity(2, artistInfoModel.Id, 1)
            };

            var model = new MainIndexModel
            {
                GenreListing  = genres,
                ArtistListing = artists,
                ArtistGenre   = artistGenres,
                ArtistInfo    = artistInfo
            };

            return(View(model));
        }
Exemplo n.º 8
0
        public IActionResult Index(int artistId, int musicianId)
        {
            var artistInfoModel   = _artist.Get(artistId);
            var musicianListModel = _artistMusician.GetAllByArtist(artistId);
            var musicianModel     = _musician.Get(musicianId);

            var instrumentModel = _instrument.GetAll();
            var instruments     = instrumentModel.Select
                                      (g => new InstrumentListingModel
            {
                Id       = g.Id,
                Name     = g.Name,
                IsMarked = _musicianInstrument.IsMarked(musicianId, g.Id)
            }
                                      ).ToList();

            var artistInfo = new ArtistListingModel
            {
                Id           = artistId,
                ArtistName   = artistInfoModel.ArtistName,
                Bio          = artistInfoModel.Bio,
                YrFormed     = artistInfoModel.YrFormed,
                YrEnded      = artistInfoModel.YrEnded,
                isActive     = artistInfoModel.isActive,
                HomeCountry  = artistInfoModel.HomeCountry,
                HomeTown     = artistInfoModel.HomeTown,
                PrimaryImage = _image.GetPrimaryImageByEntity(2, artistInfoModel.Id, 2)
            };

            //existing musicians
            var musicians = musicianListModel.Select
                                (r => new MusicianListingModel
            {
                Id           = r.Musician.Id,
                Bio          = r.Musician.Bio,
                Birth        = r.Musician.Birth,
                Death        = r.Musician.Death,
                FirstName    = r.Musician.FirstName,
                LastName     = r.Musician.LastName,
                MusicianName = r.Musician.MusicianName,
                HomeCountry  = r.Musician.HomeCountry,
                HomeTown     = r.Musician.HomeTown,
                isActive     = r.Musician.isActive,
                PrimaryImage = _image.GetPrimaryImageByEntity(5, r.Musician.Id, 1)
            }
                                ).ToList();

            //new musician
            var musician = new MusicianListingModel
            {
                Id           = musicianId,
                MusicianName = musicianModel.MusicianName,
                LastName     = musicianModel.LastName,
                FirstName    = musicianModel.FirstName,
                Bio          = musicianModel.Bio,
                Birth        = musicianModel.Birth,
                Death        = musicianModel.Death,
                isActive     = musicianModel.isActive,
                HomeTown     = musicianModel.HomeTown,
                HomeCountry  = musicianModel.HomeCountry
            };

            var model = new MusicianPostIndexModel
            {
                Artist      = artistInfo,
                Musicians   = musicians,
                Musician    = musician,
                Instruments = instruments
            };

            return(View(model));
        }
Exemplo n.º 9
0
        public IActionResult Index(int id) //Artist.Id passed in
        {
            //GET //Artist //Musician(s) //Album(s) //"Featured" Song(s)
            var artistInfoModel = _artist.Get(id);
            var musicianModel   = _artistMusician.GetAllByArtist(id);
            var albumModel      = _albumSong.GetAllAlbumsByArtist(id);
            var songModel       = _albumSong.GetRandomSongsByArtist(id);

            //Load the data objects >>

            //if (songModel or albumModel != null) ** What to do if null? **

            var songs = songModel.Select
                            (r => new SongListingModel
            {
                Id          = r.Song.Id,
                Name        = r.Song.Name,
                Duration    = r.Song.Duration,
                TrackNumber = r.TrackNumber
                              //PrimaryImage = _image.GetPrimaryImageByEntity(1, r.Album.Id, 1)
            }
                            ).ToList();

            var albums = albumModel.Select
                             (r => new AlbumListingModel
            {
                Id           = r.Album.Id,
                Name         = r.Album.Name,
                YrReleased   = r.Album.YrReleased,
                PrimaryImage = _image.GetPrimaryImageByEntity(1, r.Album.Id, 1)
            }
                             ).ToList();

            var artistInfo = new ArtistListingModel
            {
                Id           = artistInfoModel.Id,
                ArtistName   = artistInfoModel.ArtistName,
                Bio          = artistInfoModel.Bio,
                YrFormed     = artistInfoModel.YrFormed,
                YrEnded      = artistInfoModel.YrEnded,
                isActive     = artistInfoModel.isActive,
                HomeCountry  = artistInfoModel.HomeCountry,
                HomeTown     = artistInfoModel.HomeTown,
                PrimaryImage = _image.GetPrimaryImageByEntity(2, artistInfoModel.Id, 2)
            };

            var musicians = musicianModel.Select
                                (r => new MusicianListingModel
            {
                Id           = r.Musician.Id,
                Bio          = r.Musician.Bio,
                Birth        = r.Musician.Birth,
                Death        = r.Musician.Death,
                FirstName    = r.Musician.FirstName,
                LastName     = r.Musician.LastName,
                MusicianName = r.Musician.MusicianName,
                HomeCountry  = r.Musician.HomeCountry,
                HomeTown     = r.Musician.HomeTown,
                isActive     = r.Musician.isActive,
                PrimaryImage = _image.GetPrimaryImageByEntity(5, r.Musician.Id, 1)
            }
                                ).ToList();

            var model = new MainDetailModel
            {
                Artist    = artistInfo,
                Musicians = musicians,
                Albums    = albums,
                Songs     = songs
            };

            return(View(model));
        }
Exemplo n.º 10
0
        public ActionResult Edit(int id)
        {
            var artistToEdit = _artistService.Get(id);

            return(View(artistToEdit));
        }
Exemplo n.º 11
0
 public Artist Get(int id)
 {
     return(_artist.Get(id));
 }