Ejemplo n.º 1
0
        public static Band CreateBand()
        {
            Band newBand = new Band()
            {
                Name = SetInformation.SetBandName()
            };

            return(newBand);
        }
Ejemplo n.º 2
0
        public static void CreateAndSaveBand()
        {
            Band newBand = new Band()
            {
                Name = SetInformation.SetBandName()
            };

            using (var context = new MusicContext())
            {
                context.Bands.Add(newBand);
                context.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        public static Music CreateMusic(Band band)
        {
            Music newMusic = new Music()
            {
                Name = SetInformation.SetMusicName(),
                Band = band,
                SongDurationInSeconds = SetInformation.SetMusicDuration(),
                Lyrics = SetInformation.SetMusicLyrics(),
                Rating = SetInformation.SetMusicRating()
            };

            return(newMusic);
        }
Ejemplo n.º 4
0
        public static void CreateAndSaveMusic(Guid bandId)
        {
            string name         = SetInformation.SetMusicName();
            int    songDuration = SetInformation.SetMusicDuration();
            string lyrics       = SetInformation.SetMusicLyrics();
            int    rating       = SetInformation.SetMusicRating();

            using (var context = new MusicContext())
            {
                Music newMusic = new Music()
                {
                    Name = name,
                    Band = context.Bands.Find(bandId),
                    SongDurationInSeconds = songDuration,
                    Lyrics = lyrics,
                    Rating = rating
                };
                context.Musics.Add(newMusic);
                context.SaveChanges();
            }
        }