private void AddFestivalAwardsExecute() { try { var festival = _dALFestival.AllFestivals().ElementAt(SelectedFestival); var awardsForFestival = _dALAward.AllAwardsForFestival(festival.Id); int awardId = 0; if (awardsForFestival.Count > 0) { awardId = awardsForFestival.ElementAt(SelectedAward).Award_Id; } if (festival != null && awardId != 0 && !NotAwarded) { MovieFestivalAward movieFestivalAward = new MovieFestivalAward() { AwardFestival_Festival_Id = festival.Id, AwardFestival_Award_Id = awardId, }; _movieFestivalAward.Add(movieFestivalAward); } else if (festival != null && NotAwarded) { _movieFestivals.Add(festival); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void AddMovieFestivalAward(MovieFestivalAward movieFestivalAward) { using (IMDBEntities7 dbContext = new IMDBEntities7()) { MovieFestivalAward newMovieFestivalAward = new MovieFestivalAward { AwardFestival_Award_Id = movieFestivalAward.AwardFestival_Award_Id, AwardFestival_Festival_Id = movieFestivalAward.AwardFestival_Festival_Id, MovieFestival_Movie_Id = movieFestivalAward.MovieFestival_Movie_Id, Deleted = false }; dbContext.MovieFestivalAwards.Add(newMovieFestivalAward); dbContext.SaveChanges(); } }
public void AddAwardForMovie(MovieFestivalAward movieFestivalAward) { DALAward dALAward = new DALAward(); dALAward.AddMovieFestivalAward(movieFestivalAward); }