public IHttpActionResult PostFestival(Festival festival) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _dALFestival.AddFestival(festival); return(CreatedAtRoute("DefaultApi", new { id = festival.Id }, festival)); }
private void AddFestivalExecute() { try { Festival newFestival = new Festival { Name = Festival.Name, Place_Id = allPlaces.ElementAt(selectedPlace).Id, Date = DateTime.Parse(Date).ToString("dd/MM/yyyy"), Deleted = false }; newFestival.Place = _dALPlace.GetPlaceById(newFestival.Place_Id); _dALFestival.AddFestival(newFestival); _addWin.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }