public void AddNewAwardForFestival(int festivalId) { var lastAddedAward = _dALAward.AllAwards().LastOrDefault(); _dALAward.AddAwardFestival(new AwardFestival() { Award_Id = lastAddedAward.Id, Festival_Id = festivalId }); }
private void AddAwardExecute() { try { if (!string.IsNullOrEmpty(Award.Name)) { Award award = new Award() { Name = Award.Name, Deleted = false }; _dALAward.AddAward(award); var lastedAddedAward = _dALAward.AllAwards().LastOrDefault(); AwardFestival awardFestival = new AwardFestival() { Award_Id = lastedAddedAward.Id, Festival_Id = _dALFestival.AllFestivals().ElementAt(SelectedFestival).Id }; _dALAward.AddAwardFestival(awardFestival); award_window.Close(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void AddAwardFestivalExecute() { try { AwardFestival awardFestival = new AwardFestival() { Award_Id = _allAwards.ElementAt(SelectedAward).Id, Festival_Id = _allFestivals.ElementAt(SelectedFestival).Id }; if (!_allAwardFestival.Exists(a => a.Award_Id == awardFestival.Award_Id && a.Festival_Id == awardFestival.Festival_Id)) { _dALAward.AddAwardFestival(awardFestival); AwardFestival = _dALAward.AllAwardFestival(); } else { MessageBox.Show("Izabrana nagrada se vec dodjeljuje na festivalu!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }