public void DeleteGenre(int genreID)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec("Exec DeleteGenre " + genreID);
     }
 }
 public TrackAlbum GetTrackAlbumById(int?id)
 {
     using (var context = new MusicContext())
     {
         return(context.TrackAlbums.AsNoTracking().SingleOrDefault(n => n.Id == id));
     }
 }
 public void UpdateGenre(int genreID, string genre)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec("Exec UpdateGenre " + genreID + ", '" + genre + "'");
     }
 }
Ejemplo n.º 4
0
 public DataTable GetAllRatings()
 {
     using (MusicContext context = new MusicContext())
     {
         return(context.Exec <DataTable>("fetchRatings"));
     }
 }
Ejemplo n.º 5
0
 public void DeleteRating(int RatingID)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec("Exec DeleteRating " + RatingID);
     }
 }
 /// <summary>
 /// this deletes references between Genre and the selected song
 /// </summary>
 /// <param name="songID"></param>
 public void DeleteReferences(int songID)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec <DataTable>("RemoveGenreReferencesBySong " + songID);
     }
 }
        public static void AddArtists()
        {
            var    context = new MusicContext();
            Artist artist1 = new Artist {
                FirstName = "Michael", LastName = "Jackson", BirthOfDate = new DateTime(1958, 8, 29), Gender = "Male", Country = "USA"
            };
            Artist artist2 = new Artist {
                FirstName = "Ed", LastName = "Sheeran", BirthOfDate = new DateTime(1991, 2, 17), Gender = "Male", Country = "UK"
            };
            Artist artist3 = new Artist {
                FirstName = "Adele", LastName = "Adkins ", BirthOfDate = new DateTime(1988, 5, 5), Gender = "Female", Country = "UK"
            };
            Artist artist4 = new Artist {
                FirstName = "Rihanna", LastName = "Fenty", BirthOfDate = new DateTime(1988, 2, 20), Gender = "Female", Country = "Barbados"
            };
            Artist artist5 = new Artist {
                FirstName = "Stefani", LastName = "Germanotta", BirthOfDate = new DateTime(1986, 3, 28), Gender = "Female", Country = "USA"
            };
            List <Artist> myArtists = new List <Artist> {
                artist1, artist2, artist3, artist4, artist5
            };

            context.Artists.AddRange(myArtists);
            context.SaveChanges();
        }
 public void CreateReference(int songID, int ratingID)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec("Exec AddRatingToSong " + songID + ", " + ratingID);
     }
 }
 public void RemoveReference(int songID, int ratingID)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec("Exec DeleteRatingToSong " + songID + ", " + ratingID);
     }
 }
Ejemplo n.º 10
0
        // GET: Album
        public IActionResult Index()
        {
            MusicContext context = HttpContext.RequestServices.GetService(typeof(JenkinsCRUD.Models.MusicContext))
                                   as MusicContext;

            return(View(context.GetAllAlbums()));
        }
Ejemplo n.º 11
0
        public ArtistController(MusicContext context)
        {
            _context = context;

            if (_context.ArtistObjects.Count() == 0)
            {
                // DON"T JUDGE ME
                _context.ArtistObjects.Add(new Artist
                {
                    Name   = "ArtistName",
                    Albums = new List <Album>()
                    {
                        new Album {
                            Name         = "AlbumName",
                            YearReleased = 1992,
                            Songs        = new List <Song>()
                            {
                                new Song {
                                    Track        = 0,
                                    Name         = "SongName",
                                    Created      = DateTime.Now,
                                    LastModified = DateTime.Now
                                }
                            },
                            Created      = DateTime.Now,
                            LastModified = DateTime.Now
                        }
                    },
                    Created      = DateTime.Now,
                    LastModified = DateTime.Now
                });

                _context.SaveChanges();
            }
        }
Ejemplo n.º 12
0
        public async Task SearchAsync(MusicContext music, string search)
        {
            music = await new MusicSearch(music, search).RunAsync();
            if (music == null)
            {
                await music.Channel.SendMessageAsync("No result found.");

                return;
            }
            if (IsSongInPlaylist(music))
            {
                await music.Channel.SendMessageAsync($"Couldn't queue your request of **{music.Song.Title ?? music.Song.VideoId}** because it's already in the playlist.");

                return;
            }
            music = await new MusicPreemptiveDownload(music).RunAsync();
            if (music == null)
            {
                await music.Channel.SendMessageAsync("Video not found.");

                return;
            }
            if (music.Song.Duration.GetValueOrDefault().TotalMinutes > 9)
            {
                await music.Channel.SendMessageAsync("Video length exceeds limit (more than 9 minutes).");

                return;
            }
            await QueueAsync(music);
        }
Ejemplo n.º 13
0
 public List <Artist> GetAllArtists()
 {
     using (var context = new MusicContext())
     {
         return(context.Artists.AsNoTracking().ToList());
     }
 }
        public static void AddSongs()
        {
            List <Song> mySongs = new List <Song>
            {
                new Song
                {
                    Name = "Remember the time", Genre = "POP", Duration = new TimeSpan(0, 4, 0), ReleaseYear = 1991
                },
                new Song
                {
                    Name = "Heal the world", Genre = "POP", Duration = new TimeSpan(0, 6, 25), ReleaseYear = 1991
                },
                new Song
                {
                    Name = "Beat it", Genre = "POP", Duration = new TimeSpan(0, 4, 18), ReleaseYear = 1982
                },
                new Song
                {
                    Name = "I Just Can't Stop Loving You", Genre = "POP", Duration = new TimeSpan(0, 4, 12), ReleaseYear = 1995
                }
            };
            var context = new MusicContext();

            context.Songs.AddRange(mySongs);
            context.SaveChanges();
        }
 public void CreateReference(int songID, int genreID)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec("Exec AddGenreToSong " + songID + ", " + genreID);
     }
 }
Ejemplo n.º 16
0
 static void Main(string[] args)
 {
     using (var context = new MusicContext())
     {
         var albums = context.Albums;
     }
 }
        public static void AddAlbumSong()
        {
            var         context = new MusicContext();
            var         album   = context.Albums.First();
            var         song1   = context.Songs.FirstOrDefault(s => s.Name.StartsWith("Remember"));
            var         song2   = context.Songs.FirstOrDefault(s => s.Name.StartsWith("Heal"));
            List <Song> songs   = new List <Song> {
                song1, song2
            };

            foreach (var song in songs)
            {
                context.AlbumSong.Add(new AlbumSong {
                    AlbumId = album.Id, SongId = song.Id
                });
            }
            var         album1 = context.Albums.FirstOrDefault(a => a.Name.StartsWith("HIStory"));
            var         song3  = context.Songs.FirstOrDefault(s => s.Name.StartsWith("Beat"));
            var         song4  = context.Songs.FirstOrDefault(s => s.Name.StartsWith("I Just"));
            List <Song> songs1 = new List <Song> {
                song2, song3, song4
            };

            foreach (var song in songs1)
            {
                context.AlbumSong.Add(new AlbumSong {
                    AlbumId = album1.Id, SongId = song.Id
                });
            }
            context.SaveChanges();
        }
 public List <Genre> GetAllGenres()
 {
     using (var context = new MusicContext())
     {
         return(context.Genres.AsNoTracking().ToList());
     }
 }
 public void RemoveReference(int songID, int genreID)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec("Exec DeleteGenreToSong " + songID + ", " + genreID);
     }
 }
 public Genre GetGenreById(int?id)
 {
     using (var context = new MusicContext())
     {
         return(context.Genres.AsNoTracking().SingleOrDefault(n => n.Id == id));
     }
 }
Ejemplo n.º 21
0
 //Makes a List with the Music comments from the Database
 public List <Music> GetAll()
 {
     using (context = new MusicContext())
     {
         return(context.MusicComments.ToList());
     }
 }
 public void CreateReference(int songID, int artistID)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec("Exec AddArtistToSong " + songID + ", " + artistID);
     }
 }
Ejemplo n.º 23
0
 public void UpdateRating(int ratingID, string rating)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec("Exec UpdateRating " + ratingID + ", '" + rating + "'");
     }
 }
 public void RemoveReference(int songID, int artistID)
 {
     using (MusicContext context = new MusicContext())
     {
         context.Exec("Exec DeleteArtistToSong " + songID + ", " + artistID);
     }
 }
 public List <TrackAlbum> GetAllTrackAlbums()
 {
     using (var context = new MusicContext())
     {
         return(context.TrackAlbums.AsNoTracking().ToList());
     }
 }
 public DataTable GetGenreToSongInfo(int songID)
 {
     using (MusicContext context = new MusicContext())
     {
         return(context.Exec <DataTable>("fetchGenreBySongID " + songID));
     }
 }
        public static void AddVenue()
        {
            var context = new MusicContext();
            //Venue venue = new Venue { Name = "Stockholm Olympic Stadium", Address = "Lidingövägen", City = "Stockholm", Country = "Sweden" };
            //context.Venues.Add(venue);
            Venue venue1 = new Venue {
                Name = "Wembley Stadium", Address = "London HA9 0WS", City = "London", Country = "UK"
            };
            Venue venue2 = new Venue {
                Name = " Friends Arena", Address = "Råsta Strandväg 1", City = "Stockholm", Country = "Sweden"
            };
            Venue venue3 = new Venue {
                Name = "Telenor Arena", Address = "Widerøeveien 1", City = "Oslo", Country = "Norway"
            };
            Venue venue4 = new Venue {
                Name = "AccorHotels Arena", Address = "8 Boulevard de Bercy", City = "Paris", Country = "France"
            };
            Venue venue5 = new Venue {
                Name = "Citi Field", Address = "120–01 Roosevelt Avenue", City = "New York", Country = "USA"
            };
            Venue venue6 = new Venue {
                Name = " Toyota Center", Address = "1510 Polk Street", City = "Houston", Country = "USA"
            };
            List <Venue> venues = new List <Venue> {
                venue1, venue2, venue3, venue4, venue5, venue6
            };

            context.Venues.AddRange(venues);
            context.SaveChanges();
        }
Ejemplo n.º 28
0
        public void AddMembers(string first, string last, string term, string instrument)
        {
            var member = new BandMember()
            {
                Term = term
            };

            using (var context = new MusicContext())
            {
                member.Member = context.People.SingleOrDefault(b => b.FirstName.Equals(first) &&
                                                               b.LastName.Equals(last));
                member.Instrument = context.Instruments.SingleOrDefault(b => b.Description.Equals(instrument));
                member.Band       = context.Bands.SingleOrDefault(b => b.Name.Equals("Yes"));

                var existing = context.Bands.SingleOrDefault(b => b.Name.Equals("Yes") &&
                                                             b.Members.Count(m => m.Member.FirstName.Equals(first) &&
                                                                             m.Member.LastName.Equals(last) &&
                                                                             m.Instrument.Description.Equals(instrument)
                                                                             ) > 0
                                                             );

                if (existing == null)
                {
                    context.BandMembers.Add(member);
                    context.SaveChanges();
                }
            }
        }
        public SongRepositoryTests()
        {
            db = new MusicContext();
            db.Database.BeginTransaction();

            underTest = new SongRepository(db);
        }
Ejemplo n.º 30
0
        public ProductController(MusicContext db, IProduct product, IConfiguration config)
        {
            string PublicKey = config["Stripe:PublicKey"].ToString();

            _db      = db;
            _product = product;
        }
Ejemplo n.º 31
0
 public MusicController()
 {
     SelectedMusic = AvailableMusics[Main.Random.Next(0, AvailableMusics.Count)];
     AvailableMusics.Remove(SelectedMusic);
     Context = MusicContext.Other;
     SwitchMusicRandomly = false;
     CanChangeMusic = true;
 }
Ejemplo n.º 32
0
 private static void Main(string[] args)
 {
     using (var context = new MusicContext())
     {
         var album = new Album { Price = 12m, Title = "drushyam" };
         context.Albums.Add(album);
         context.SaveChanges();
     }
 }
Ejemplo n.º 33
0
 public SetupController(MusicContext musicContext)
 {
     _musicContext = musicContext;
 }
Ejemplo n.º 34
0
        public void SwitchTo(MusicContext context, string musicName, bool playNow)
        {
            Audio.StopMusic(SelectedMusic, true, 500);

            string lastMusic = SelectedMusic;

            // current
            switch (context)
            {
                case MusicContext.Won:
                    SelectedMusic = musicName == null ? AvailableGameWonMusics[Main.Random.Next(0, AvailableGameWonMusics.Count)] : musicName;
                    AvailableGameWonMusics.Remove(SelectedMusic);
                    CanChangeMusic = true;
                    break;
                case MusicContext.Lost:
                    SelectedMusic = musicName == null ? AvailableGameLostMusics[Main.Random.Next(0, AvailableGameLostMusics.Count)] : musicName;
                    AvailableGameLostMusics.Remove(SelectedMusic);
                    CanChangeMusic = true;
                    break;
                case MusicContext.Other:
                    SelectedMusic = musicName == null ? AvailableMusics[Main.Random.Next(0, AvailableMusics.Count)] : musicName;
                    AvailableMusics.Remove(SelectedMusic);
                    CanChangeMusic = true;
                    break;
                case MusicContext.Cutscene:
                    SelectedMusic = musicName == null ? AvailableCutsceneMusics[Main.Random.Next(0, AvailableCutsceneMusics.Count)] : musicName;
                    AvailableCutsceneMusics.Remove(SelectedMusic);
                    CanChangeMusic = false;
                    break;
            }


            // previous
            switch (Context)
            {
                case MusicContext.Won: AvailableGameWonMusics.Add(lastMusic); break;
                case MusicContext.Lost: AvailableGameLostMusics.Add(lastMusic); break;
                case MusicContext.Other: AvailableMusics.Add(lastMusic); break;
                case MusicContext.Cutscene: AvailableCutsceneMusics.Add(lastMusic); break;
            }

            Context = context;

            if (playNow)
                Audio.PlayMusic(SelectedMusic, true, FadeTime, true);
        }
Ejemplo n.º 35
0
 public void SwitchTo(MusicContext context)
 {
     SwitchTo(context, null, true);
 }