Пример #1
0
        public IActionResult AddAlbum(AlbumPostIndexModel model)
        {
            if (model == null)
            {
                RedirectToAction("ArtistInfo", new { id = model.Artist.Id });
            }

            var artistModel = model.Artist;
            var albumModel  = model.Album;

            //add the album - populate an Album instance with values from the form
            var album = new Album
            {
                Id         = albumModel.Id,
                Name       = albumModel.Name,
                YrReleased = albumModel.YrReleased
            };

            _album.Add(album);

            _albumSong.Add(album.Id, artistModel.Id, 0, 0);

            return(RedirectToAction("Index", "AlbumMod",
                                    new { artistId = artistModel.Id, albumId = album.Id }));
        }
Пример #2
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));
        }
Пример #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));
        }