public ComicBooksController()
 {
     // passing in BaseController's Context property
     _comicBooksRepository = new ComicBooksRepository(Context);
     _seriesRepository     = new SeriesRepository(Context);
     _artistsRepository    = new ArtistsRepository(Context);
 }
 public ComicBooksController()
 {
     // Context parameter is BaseController's Context property
     _comicBookRepository = new ComicBookRepository(Context);
     _seriesRepository    = new SeriesRepository(Context);
     _artistsRepository   = new ArtistsRepository(Context);
 }
        internal static int AddArtist()
        {
            // It is possible to avoid the goto keyword as in SongsView.AddSong().
AddArtist:
            Console.Clear();
            Console.Write("Enter new artist name: ");
            string inputArtistName = Console.ReadLine();

            if (inputArtistName.Length < 1)
            {
                Console.WriteLine("Artist name cannot be empty. Try again!!");
                Console.ReadKey(true);
                goto AddArtist;
            }

            ArtistsRepository artistsRepo = new ArtistsRepository(Constants.ArtistsPath);

            if (artistsRepo.EntityExists(a => a.Name == inputArtistName))
            {
                Console.WriteLine("The artist already exists in the database!");
                Console.ReadKey(true);
                return(default(int));
            }
            Artist artist = new Artist();

            artist.Name = inputArtistName;
            int returnId = artistsRepo.Save(artist);

            Console.WriteLine("Artist saved successfully!");
            Console.ReadKey(true);
            return(returnId);
        }
        public void DeleteArtist()
        {
            ViewArtists();
            Console.WriteLine();
InputId:
            Console.Write("Enter artist id to delete: ");
            int  deleteId;
            bool isInt = int.TryParse(Console.ReadLine(), out deleteId);

            while (isInt == false)
            {
                Console.WriteLine("IDs can only be integer numbers. Try again!!");
                Console.ReadKey(true);
                goto InputId;
            }

            ArtistsRepository artistsRepo = new ArtistsRepository(Constants.ArtistsPath);
            Artist            artist      = artistsRepo.GetAll(a => a.Id == deleteId).FirstOrDefault();

            if (artist == null)
            {
                Console.WriteLine("No artist with that Id exists in the system yet!");
                Console.ReadKey(true);
                return;
            }
            SongsArtistsRepository songsArtistsRepo     = new SongsArtistsRepository(Constants.SongsArtistsPath);
            List <SongsArtists>    songsArtistsEntities = songsArtistsRepo.GetAll(sae => sae.ArtistId == deleteId);
            SongsRepository        songsRepo            = new SongsRepository(Constants.SongsPath);
            List <Song>            songs = new List <Song>();

            foreach (SongsArtists songsArtistsEntity in songsArtistsEntities)
            {
                Song song = songsRepo.GetAll(s => s.Id == songsArtistsEntity.SongId).FirstOrDefault();
                songs.Add(song);
            }

            PlaylistsSongsRepository playlistsSongsRepo     = new PlaylistsSongsRepository(Constants.PlaylistsSongsPath);
            List <PlaylistsSongs>    playlistsSongsEntities = new List <PlaylistsSongs>();

            foreach (SongsArtists songsArtistsEntity in songsArtistsEntities)
            {
                PlaylistsSongs playlistSongEntity = playlistsSongsRepo.GetAll(pse => pse.SongId == songsArtistsEntity.SongId).FirstOrDefault();
                playlistsSongsEntities.Add(playlistSongEntity);
            }

            foreach (PlaylistsSongs playlistsSongsEntity in playlistsSongsEntities)
            {
                playlistsSongsRepo.Delete(playlistsSongsEntity);
            }

            foreach (Song song in songs)
            {
                songsRepo.Delete(song);
            }

            artistsRepo.Delete(artist);
            Console.WriteLine("Artist deleted successfully!");
            Console.ReadKey(true);
        }
 /// <summary>
 /// Initializes the view model.
 /// </summary>
 public virtual void Init(Repository repository,
                          SeriesRepository seriesRepository,
                          ArtistsRepository artistsRepository)
 {
     SeriesSelectListItems = new SelectList(
         seriesRepository.GetList(),
         "Id", "Title");
 }
Esempio n. 6
0
        public IActionResult Add(string name, string specialty, string location, int phone)
        {
            ArtistsRepository repo = new ArtistsRepository();

            repo.InsertArtist(name, specialty, location, phone);

            return(RedirectToAction("Index")); //misspelled Artists
        }
Esempio n. 7
0
 /// <summary>
 /// Initializes the view model.
 /// </summary>
 public void Init(Repository repository, ArtistsRepository artistsRepository)
 {
     ArtistSelectListItems = new SelectList(
         artistsRepository.GetList(),
         "Id", "Name");
     RoleSelectListItems = new SelectList(
         repository.GetRoles(),
         "Id", "Name");
 }
 /// <summary>
 /// Initializes the view model.
 /// </summary>
 public virtual void Init(Repository repository,
                          SeriesRepository seriesRepository, ArtistsRepository artistsRepository)
 {
     // create a select dropdown variable which gets the context's
     // Series list, ordered by title
     SeriesSelectListItems = new SelectList(
         seriesRepository.GetList(),
         "Id", "Title");
 }
 /// <summary>
 /// Initializes the view model.
 /// </summary>
 public void Init(Repository repository, ArtistsRepository artistsRepository)
 {
     ArtistSelectListItems = new SelectList(
         artistsRepository.GetList(), // TODO Get the artitsts list.
         "Id", "Name");
     RoleSelectListItems = new SelectList(
         repository.GetRoles(), // TODO Get the roles list.
         "Id", "Name");
 }
Esempio n. 10
0
        public IActionResult Artists()
        {
            ViewData["Message"] = "Your application description page.";

            ArtistsRepository repo = new ArtistsRepository();

            List <Artist> artists = repo.GetAllArtists();

            return(View(artists));
        }
Esempio n. 11
0
        public IActionResult Index()
        {
            ArtistsRepository repo = new ArtistsRepository();

            ArtistsViewModels viewModel = new ArtistsViewModels();

            viewModel.Artists = repo.GetAllArtists();//now we give artists a value

            return(View(viewModel));
            //test
        }
        protected override void Seed(TestRockstars.DAL.DatabaseContext context)
        {
            JSONParser        parse            = new JSONParser();
            SongsRepository   songRepository   = new SongsRepository(context);
            ArtistsRepository artistRepository = new ArtistsRepository(context);

            artistRepository.ClearArtists();
            songRepository.ClearSongs();
            songRepository.AddSong(parse.GetSongs().ToArray());
            artistRepository.AddArtist(parse.GetArtists().ToArray());
        }
        /// <summary>
        /// Initializes the view model.
        /// </summary>
        public override void Init(Repository repository,
                                  SeriesRepository seriesRepository, ArtistsRepository artistsRepository)
        {
            base.Init(repository, seriesRepository, artistsRepository);

            ArtistSelectListItems = new SelectList(
                artistsRepository.GetList(),
                "Id", "Name");
            RoleSelectListItems = new SelectList(
                repository.GetRoles(),
                "Id", "Name");
        }
        public static bool ViewSongs(bool calledFromSongsView = false)
        {
            SongsRepository        songsRepo        = new SongsRepository(Constants.SongsPath);
            SongsArtistsRepository songsArtistsRepo = new SongsArtistsRepository(Constants.SongsArtistsPath);
            ArtistsRepository      artistsRepo      = new ArtistsRepository(Constants.ArtistsPath);
            List <Song>            songs            = songsRepo.GetAll();

            Console.Clear();
            if (songs.Count == 0)
            {
                Console.WriteLine("There are no songs in the system yet!");
                Console.ReadKey(true);
                return(false);
            }
            foreach (Song song in songs)
            {
                Console.WriteLine("********************************");
                Console.WriteLine("Id: {0}", song.Id);
                Console.WriteLine("Song title: {0}", song.Title);
                Console.WriteLine("Song release year: {0}", song.Year);
                List <SongsArtists> songsArtists = songsArtistsRepo.GetAll(sa => sa.SongId == song.Id);
                List <Artist>       artists      = new List <Artist>();
                foreach (SongsArtists songArtistItem in songsArtists)
                {
                    int    artistId = songArtistItem.ArtistId;
                    Artist artist   = artistsRepo.GetAll(a => a.Id == songArtistItem.ArtistId).FirstOrDefault();
                    artists.Add(artist);
                }

                if (artists.Count == 1)
                {
                    Console.WriteLine("Artist: {0}", artists[0].Name);
                }
                else
                {
                    Console.Write("Artists: ");
                    int end = artists.Count - 1;
                    for (int i = 0; i < end; i++)
                    {
                        Console.WriteLine("{0}, ", artists[i].Name);
                    }
                    Console.WriteLine(artists[end]);
                }
                Console.WriteLine("********************************");
            }
            if (calledFromSongsView)
            {
                Console.ReadKey(true);
            }
            return(true);
        }
        public void AddArtist()
        {
            var mockSet = new Mock <DbSet <Artist> >();

            var mockContext = new Mock <DatabaseContext>();

            mockContext.Setup(m => m.Artists).Returns(mockSet.Object);

            var service = new ArtistsRepository(mockContext.Object);

            service.AddArtist(testArtist);

            mockSet.Verify(m => m.Add(testArtist), Times.Once());
            mockContext.Verify(m => m.SaveChanges(), Times.Once());
        }
Esempio n. 16
0
        public ArtistsController(ArtistsRepository artistsRepository, INotificationService notificationService, ILogger <ArtistsController> logger, IMemoryCache memoryCache)
        {
            this.artistsRepository   = artistsRepository;
            this.notificationService = notificationService;
            _logger          = logger;
            this.memoryCache = memoryCache;


            this.cacheEntryOptions = new MemoryCacheEntryOptions();

            // set AbsoluteExpiration
            //options.AbsoluteExpiration = DateTime.Now.AddMinutes(1);

            // set SlidingExpiration
            this.cacheEntryOptions.SlidingExpiration = TimeSpan.FromMinutes(10);
        }
        public void EditArtist()
        {
            ArtistsRepository artistRepo = new ArtistsRepository(Constants.ArtistsPath);

EditArtist:
            List <Artist> artists = artistRepo.GetAll();

            Console.Clear();
            foreach (Artist artistEntity in artists)
            {
                Console.WriteLine("************************************");
                Console.WriteLine("Id: {0}", artistEntity.Id);
                Console.WriteLine("Artist name: {0}", artistEntity.Name);
                Console.WriteLine("************************************");
            }
            Console.WriteLine();
            Console.Write("Enter id to edit: ");
            int  inputArtistId;
            bool isInt = int.TryParse(Console.ReadLine(), out inputArtistId);

            while (isInt == false)
            {
                Console.WriteLine("Id should be an integer number. Try again!!");
                Console.ReadKey(true);
                goto EditArtist;
            }

            Artist artist = new Artist();

            Console.WriteLine("Editing artist with Id: {0}", inputArtistId);
EnterArtistName:
            Console.Write("Enter new artist name: ");
            string inputArtistName = Console.ReadLine();

            if (inputArtistName.Length < 1)
            {
                Console.WriteLine("Artist name cannot be empty. Try Again!!");
                Console.ReadKey(true);
                goto EnterArtistName;
            }
            artist.Id   = inputArtistId;
            artist.Name = inputArtistName;
            artistRepo.Save(artist);
            Console.WriteLine("Artist edited successfully!");
            Console.ReadKey(true);
        }
        internal void ViewArtists(bool calledFromArtistsView = false)
        {
            ArtistsRepository artistsRepo = new ArtistsRepository(Constants.ArtistsPath);
            List <Artist>     artists     = artistsRepo.GetAll();

            Console.Clear();
            foreach (Artist artist in artists)
            {
                Console.WriteLine("***************************************");
                Console.WriteLine("Id: {0}", artist.Id);
                Console.WriteLine("Artist name: {0}", artist.Name);
                Console.WriteLine("***************************************");
            }
            if (calledFromArtistsView == true)
            {
                Console.ReadKey(true);
            }
        }
        public void GetArtists()
        {
            var data = new List <Artist>
            {
                testArtist
            }.AsQueryable();

            var mockSet = new Mock <DbSet <Artist> >();

            mockSet.As <IQueryable <Artist> >().Setup(m => m.Provider).Returns(data.Provider);
            mockSet.As <IQueryable <Artist> >().Setup(m => m.Expression).Returns(data.Expression);
            mockSet.As <IQueryable <Artist> >().Setup(m => m.ElementType).Returns(data.ElementType);
            mockSet.As <IQueryable <Artist> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

            var mockContext = new Mock <DatabaseContext>();

            mockContext.Setup(c => c.Artists).Returns(mockSet.Object);

            var service = new ArtistsRepository(mockContext.Object);
            var artists = service.GetArtists();

            Assert.AreEqual(1, artists.Count());
        }
        public void ViewSpecificPlaylist()
        {
            ViewUserPlaylists();
            Console.WriteLine();
            Console.Write("Enter playlist id to view: ");
            int  currentUserId = AuthenticationService.LoggedUser.Id;
            int  playlistId;
            bool isIntPlaylistId = int.TryParse(Console.ReadLine(), out playlistId);

            while (isIntPlaylistId == false)
            {
                Console.WriteLine("Id can only be an integer number");
                Console.Write("Enter playlist id to view: ");
                isIntPlaylistId = int.TryParse(Console.ReadLine(), out playlistId);
            }

            UsersPlaylistsRepository usersPlaylistsRepo = new UsersPlaylistsRepository(Constants.UsersPlaylistsPath);
            bool hasRightsToShare = usersPlaylistsRepo.EntityExists(upe => upe.PlaylistId == playlistId && upe.UserId == currentUserId);

            if (hasRightsToShare == false)
            {
                Console.WriteLine("Playlist does not exist or you have no rights to view!");
                Console.ReadKey(true);
                return;
            }
            PlaylistsSongsRepository playlistsSongsRepo     = new PlaylistsSongsRepository(Constants.PlaylistsSongsPath);
            List <PlaylistsSongs>    playlistsSongsEntities = playlistsSongsRepo.GetAll(pse => pse.PlaylistId == playlistId);
            SongsRepository          songsRepo        = new SongsRepository(Constants.SongsPath);
            SongsArtistsRepository   songsArtistsRepo = new SongsArtistsRepository(Constants.SongsArtistsPath);
            ArtistsRepository        artistsRepo      = new ArtistsRepository(Constants.ArtistsPath);
            List <Song> songs = new List <Song>();

            foreach (PlaylistsSongs playlistsSongsEntity in playlistsSongsEntities)
            {
                Song song = songsRepo.GetAll(s => s.Id == playlistsSongsEntity.SongId).FirstOrDefault();
                songs.Add(song);
            }

            if (songs.Count == 0)
            {
                Console.WriteLine("Playlist empty!");
                Console.ReadKey(true);
                return;
            }

            Console.Clear();
            foreach (Song song in songs)
            {
                Console.WriteLine("********************************");
                Console.WriteLine("Id: {0}", song.Id);
                Console.WriteLine("Song title: {0}", song.Title);
                Console.WriteLine("Song release year: {0}", song.Year);
                List <SongsArtists> songsArtists = songsArtistsRepo.GetAll(sa => sa.SongId == song.Id);
                List <Artist>       artists      = new List <Artist>();
                foreach (SongsArtists songArtistItem in songsArtists)
                {
                    int    artistId = songArtistItem.ArtistId;
                    Artist artist   = artistsRepo.GetAll(a => a.Id == songArtistItem.ArtistId).FirstOrDefault();
                    artists.Add(artist);
                }

                if (artists.Count == 1)
                {
                    Console.WriteLine("Artist: {0}", artists[0].Name);
                }
                else
                {
                    Console.Write("Artists: ");
                    int end = artists.Count - 1;
                    for (int i = 0; i < end; i++)
                    {
                        Console.WriteLine("{0}, ", artists[i].Name);
                    }
                    Console.WriteLine(artists[end]);
                }
                Console.WriteLine("********************************");
            }

            Console.ReadKey(true);
        }
 public ComicBooksController()                                  //Default Construcor to insantiate an instance of the repository
 {
     _comicBooksRepository = new ComicBooksRepository(Context); // pass in the base controllers context property
     _seriesRepository     = new SeriesRepository(Context);     // pass in the base controllers context property
     _artistsRepository    = new ArtistsRepository(Context);    // pass in the base controllers context property
 }
Esempio n. 22
0
 public ComicBookArtistsController()
 {
     _comicBookRepository       = new ComicBookRepository(Context);
     _comicBookArtistRepository = new ComicBookArtistRepository(Context);
     _artistsRepository         = new ArtistsRepository(Context);
 }
Esempio n. 23
0
 public ComicBooksController()
 {
     _comicBooksRepository = new ComicBooksRepository(Context);
     _seriesRepository     = new SeriesRepository(Context);
     _artistsRepository    = new ArtistsRepository(Context);
 }
        public void AddSong()
        {
            string inputSongTitle;
            bool   isEmptyName = false;

            do
            {
                Console.Clear();
                Console.Write("Enter new song name: ");
                inputSongTitle = Console.ReadLine();
                isEmptyName    = (String.IsNullOrWhiteSpace(inputSongTitle));
                if (isEmptyName == true)
                {
                    Console.WriteLine("Song title cannot be empty. Try again!!");
                    Console.ReadKey(true);
                }
            }while (isEmptyName == true);

            short inputSongReleaseYear;
            bool  isShortYear;
            bool  isBeforeCurrentYear = false;

            do
            {
                Console.Write("Enter song's release year: ");
                isShortYear = short.TryParse(Console.ReadLine(), out inputSongReleaseYear);
                if (DateTime.Now.Year >= inputSongReleaseYear)
                {
                    isBeforeCurrentYear = true;
                }
                if (isShortYear == false)
                {
                    Console.WriteLine("Year can only be an integer number. Try again!!");
                    Console.ReadKey(true);
                }

                if (isBeforeCurrentYear == false)
                {
                    Console.WriteLine("Year should not be after the current year.");
                }
            } while (isShortYear == false || isBeforeCurrentYear == false);

            Song newSong = new Song();

            newSong.Title = inputSongTitle;
            newSong.Year  = inputSongReleaseYear;
            SongsRepository songsRepo = new SongsRepository(Constants.SongsPath);

            if (songsRepo.EntityExists(s => s.Title == inputSongTitle && s.Year == inputSongReleaseYear))
            {
                Console.WriteLine("The song already exists in the database!");
                Console.ReadKey(true);
            }
            int songId = songsRepo.Save(newSong);
            ArtistsRepository artistsRepo = new ArtistsRepository(Constants.ArtistsPath);
            List <Artist>     artists     = artistsRepo.GetAll();

            Console.Clear();
            int artistId;

            if (artists.Count == 0)
            {
                artistId = ArtistsView.AddArtist();
            }
            else
            {
                foreach (Artist artistEntity in artists)
                {
                    Console.WriteLine("************************************");
                    Console.WriteLine("Id: {0}", artistEntity.Id);
                    Console.WriteLine("Artist name: {0}", artistEntity.Name);
                    Console.WriteLine("************************************");
                }

                Console.WriteLine();
EnterArtistId:
                Console.Write("Enter new song's artist id (type \"0\" if not in the list): ");
                bool isInt = int.TryParse(Console.ReadLine(), out artistId);
                while (isInt == false)
                {
                    Console.WriteLine("IDs can only be integer numbers. Try Again!!");
                    Console.ReadKey(true);
                    goto EnterArtistId;
                }

                if (artistId == 0)
                {
                    artistId = ArtistsView.AddArtist();
                }
            }
            SongsArtists songArtistEntity = new SongsArtists();

            songArtistEntity.SongId   = songId;
            songArtistEntity.ArtistId = artistId;
            SongsArtistsRepository songsArtistsRepo = new SongsArtistsRepository(Constants.SongsArtistsPath);

            songsArtistsRepo.Save(songArtistEntity);
            Console.WriteLine("Song saved successfully!");
            Console.ReadKey(true);
        }
        public void ViewPublicPlaylists()
        {
            PlaylistsRepository    playlistsRepo     = new PlaylistsRepository(Constants.PlaylistsPath);
            List <Playlist>        playlists         = playlistsRepo.GetAll();
            IEnumerable <Playlist> filteredPlaylists = playlists.Where(p => p.IsPublic == true);

            Console.Clear();
            foreach (Playlist playlist in filteredPlaylists)
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("Id: {0}", playlist.Id);
                Console.WriteLine("Playlist name: {0}", playlist.Name);
                if (string.IsNullOrWhiteSpace(playlist.Description) == false)
                {
                    Console.WriteLine("Description: {0}", playlist.Description);
                }
                Console.WriteLine("*************************************");
            }

            Console.WriteLine();
            Console.Write("Enter playlist id to see: ");
            int  playlistId;
            bool isIntPlaylistId = int.TryParse(Console.ReadLine(), out playlistId);

            while (isIntPlaylistId == false)
            {
                Console.WriteLine("Playlist id can only be an integer number!");
                Console.ReadKey();
                Console.Write("Enter playlist id to see: ");
                isIntPlaylistId = int.TryParse(Console.ReadLine(), out playlistId);
            }

            PlaylistsSongsRepository playlistsSongsRepo     = new PlaylistsSongsRepository(Constants.PlaylistsSongsPath);
            SongsArtistsRepository   songsArtistsRepo       = new SongsArtistsRepository(Constants.SongsArtistsPath);
            ArtistsRepository        artistsRepo            = new ArtistsRepository(Constants.ArtistsPath);
            SongsRepository          songsRepo              = new SongsRepository(Constants.SongsPath);
            List <PlaylistsSongs>    playlistsSongsEntities = playlistsSongsRepo.GetAll(pse => pse.PlaylistId == playlistId);
            List <Song> songs = new List <Song>();

            foreach (PlaylistsSongs playlistsSongsEntity in playlistsSongsEntities)
            {
                Song song = songsRepo.GetAll(s => s.Id == playlistsSongsEntity.SongId).FirstOrDefault();
                songs.Add(song);
            }

            Console.Clear();
            foreach (Song song in songs)
            {
                Console.WriteLine("********************************");
                Console.WriteLine("Id: {0}", song.Id);
                Console.WriteLine("Song title: {0}", song.Title);
                Console.WriteLine("Song release year: {0}", song.Year);
                List <SongsArtists> songsArtists = songsArtistsRepo.GetAll(sa => sa.SongId == song.Id);
                List <Artist>       artists      = new List <Artist>();
                foreach (SongsArtists songArtistItem in songsArtists)
                {
                    int    artistId = songArtistItem.ArtistId;
                    Artist artist   = artistsRepo.GetAll(a => a.Id == songArtistItem.ArtistId).FirstOrDefault();
                    artists.Add(artist);
                }

                if (artists.Count == 1)
                {
                    Console.WriteLine("Artist: {0}", artists[0].Name);
                }
                else
                {
                    Console.Write("Artists: ");
                    int end = artists.Count - 1;
                    for (int i = 0; i < end; i++)
                    {
                        Console.WriteLine("{0}, ", artists[i].Name);
                    }
                    Console.WriteLine(artists[end]);
                }
                Console.WriteLine("********************************");
            }

            Console.ReadKey(true);
        }
        protected override void SetupContext(ISession session)
        {
            Mock<IValidator> v = new Mock<IValidator>();
            m_repository = new ArtistsRepository(session, v.Object);

            SortedDictionary<int, Artist> artists = new SortedDictionary<int, Artist>();
            for (int i = 1; i <= 4; i++)
            {
                artists.Add(i, new Artist { Name = i.ToString() });
            }

            Genre pop = new Genre { Name = "Pop" };
            pop.AddArtists(artists.Values.Take(2));

            Genre rock = new Genre { Name = "Rock" };
            rock.AddArtists(artists.Values.Skip(2).Take(2));

            session.Save(pop);
            session.Save(rock);
        }
 public ArtistsService(ArtistsRepository repo)
 {
     _repo = repo;
 }
        public void RemoveSongFromPlaylist()
        {
            ViewUserPlaylists();
            Console.WriteLine();
            Console.Write("Enter id of playlist: ");
            int  playlistId;
            bool isIntPlaylistId = int.TryParse(Console.ReadLine(), out playlistId);

            while (isIntPlaylistId == false)
            {
                Console.WriteLine("Id can only be an integer number. Try again!!");
                Console.ReadKey();
                Console.Write("Enter id of playlist: ");
                isIntPlaylistId = int.TryParse(Console.ReadLine(), out playlistId);
            }

            UsersPlaylistsRepository usersPlaylistsRepo = new UsersPlaylistsRepository(Constants.UsersPlaylistsPath);
            int currentUserId = AuthenticationService.LoggedUser.Id;

            if (usersPlaylistsRepo.EntityExists(upe => upe.PlaylistId == playlistId && upe.UserId == currentUserId) == false)
            {
                Console.WriteLine("Playlist does not exist exist or you have no rights to add songs to it!");
                Console.ReadKey(true);
                return;
            }

            PlaylistsSongsRepository playlistsSongsRepo     = new PlaylistsSongsRepository(Constants.PlaylistsSongsPath);
            List <PlaylistsSongs>    playlistsSongsEntities = playlistsSongsRepo.GetAll(pse => pse.PlaylistId == playlistId);
            SongsRepository          songsRepo        = new SongsRepository(Constants.SongsPath);
            SongsArtistsRepository   songsArtistsRepo = new SongsArtistsRepository(Constants.SongsArtistsPath);
            ArtistsRepository        artistsRepo      = new ArtistsRepository(Constants.ArtistsPath);
            List <Song> songs = new List <Song>();

            foreach (PlaylistsSongs playlistSongsEntity in playlistsSongsEntities)
            {
                Song song = songsRepo.GetAll(s => s.Id == playlistSongsEntity.SongId).FirstOrDefault();
                songs.Add(song);
            }

            Console.Clear();
            foreach (Song song in songs)
            {
                Console.WriteLine("********************************");
                Console.WriteLine("Id: {0}", song.Id);
                Console.WriteLine("Song title: {0}", song.Title);
                Console.WriteLine("Song release year: {0}", song.Year);
                List <SongsArtists> songsArtists = songsArtistsRepo.GetAll(sa => sa.SongId == song.Id);
                List <Artist>       artists      = new List <Artist>();
                foreach (SongsArtists songArtistItem in songsArtists)
                {
                    int    artistId = songArtistItem.ArtistId;
                    Artist artist   = artistsRepo.GetAll(a => a.Id == songArtistItem.ArtistId).FirstOrDefault();
                    artists.Add(artist);
                }

                if (artists.Count == 1)
                {
                    Console.WriteLine("Artist: {0}", artists[0].Name);
                }
                else
                {
                    Console.Write("Artists: ");
                    int end = artists.Count - 1;
                    for (int i = 0; i < end; i++)
                    {
                        Console.WriteLine("{0}, ", artists[i].Name);
                    }
                    Console.WriteLine(artists[end]);
                }
                Console.WriteLine("********************************");
            }
            Console.WriteLine();
            Console.Write("Select song id to remove from the playlist: ");
            int  songId;
            bool isIntSongId = int.TryParse(Console.ReadLine(), out songId);

            while (isIntSongId == false)
            {
                Console.WriteLine("Id can only be an integer number. Try again!!");
                Console.ReadKey();
                Console.Write("Select song id to remove from the playlist: ");
                isIntSongId = int.TryParse(Console.ReadLine(), out songId);
            }

            PlaylistsSongs playlistsSongsEntity = playlistsSongsRepo.GetAll(pse => pse.PlaylistId == playlistId && pse.SongId == songId).FirstOrDefault();

            if (playlistsSongsEntity == null)
            {
                Console.WriteLine("Song does not exist in that playlist or you have no rights to remove!");
                Console.ReadKey(true);
                return;
            }
            playlistsSongsRepo.Delete(playlistsSongsEntity);
            Console.WriteLine("Song successfully removed from playlist!");
            Console.ReadKey(true);
        }
 public ArtistsController()
 {
     _artistsRepository = new ArtistsRepository(Context);
 }
 /// <summary>
 /// Initializes the view model.
 /// </summary>
 public virtual void Init(Repository repository, SeriesRepository seriesRepository, ArtistsRepository artistsRepository)
 {
     SeriesSelectListItems = new SelectList(
         //new List<Series>(), // TODO Get the series list.
         seriesRepository.GetList(),
         "Id", "Title");
 }