public bool AddArtistShowDataToDataTable(AddArtistToShowModel model) { var entity = new ArtistShowData() { ArtistID = model.ArtistID, //IsHeadLiner = model.IsHeadLiner, ShowID = model.ShowID, }; using (var ctx = new ApplicationDbContext()) { ctx.ArtistShowDatas.Add(entity); return(ctx.SaveChanges() == 1); } }
// Add EXISTING artist to artistShowData // public bool AddShowToArtistShowObject(int showID, int artistID) { var artistShowData = new ArtistShowData(); using (var ctx = new ApplicationDbContext()) { var entity = ctx .Shows .Single(e => e.ShowID == showID); artistShowData.ShowID = showID; artistShowData.ArtistID = artistID; return(ctx.SaveChanges() == 1); } }