public static Band CreateBand() { Band newBand = new Band() { Name = SetInformation.SetBandName() }; return(newBand); }
public static void CreateAndSaveBand() { Band newBand = new Band() { Name = SetInformation.SetBandName() }; using (var context = new MusicContext()) { context.Bands.Add(newBand); context.SaveChanges(); } }
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); }
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(); } }