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()); } }
public IHttpActionResult PostAward(Award award) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _dALAward.AddAward(award); return(CreatedAtRoute("DefaultApi", new { id = award.Id }, award)); }