public void Review(ReviewDto review) { using (var context = new MusicArchiveContext()) { var album = context.Albums.Single(a => a.Id == review.Id); var newReview = new Review { Rating = review.Rating, ReviewText = review.ReviewText }; album.Reviews.Add(newReview); context.SaveChanges(); } }
public void AddBand(NewBandBindingModel newBand) { using (var context = new MusicArchiveContext()) { var band = new Band { Name = newBand.Name, CountryOfOrgin = newBand.CountryOfOrigin, Genre = newBand.Genre, FormedIn = newBand.YearOfFormation, LyricalThemes = JoinTags(newBand.LyricalThemes) }; context.Bands.Add(band); context.SaveChanges(); } }