private async void EditEventButton_Click(object sender, RoutedEventArgs e) { Event updatedEvent = new Event() { EventID = Int32.Parse(eventID.Text), Name = eventName.Text, EventType = eventType.Text, Location = eventLocation.Text, Date = eventDateTime.DisplayDate, Description = eventDescription.Text, MaxNumberOfCharacters = (int)eventMaxParticipants.Value, GuildID = localEvent.GuildID, RowId = localEvent.RowId }; var response = await client.PostAsJsonAsync("api/Guild/events/update", updatedEvent); if (response.IsSuccessStatusCode) { DataGrid.FillDataGrid(); WpfMessageBox.Show("Event updated", "Successfully updated event information.", MessageBoxButton.OK, MessageBoxImage.Information); } else { WpfMessageBox.Show("Error", "Error Code" + response.StatusCode + " : Message - " + response.ReasonPhrase, MessageBoxButton.OK, MessageBoxImage.Error); } Close(); }
private void JoinEventButton_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(characterRoleBox.Text)) { EventCharacter newEventCharacter = new EventCharacter() { EventID = int.Parse(eventIDBox.Text), CharacterName = (string)App.Current.Properties["SelectedCharacter"], CharacterRole = characterRoleBox.Text, SignUpDateTime = DateTime.Now, }; var response = client.PostAsJsonAsync("api/Guild/events/join", newEventCharacter).Result; if (response.IsSuccessStatusCode) { WpfMessageBox.Show("Successfully joined event", "You have successfully joined this event!", MessageBoxButton.OK, MessageBoxImage.Information); } else { WpfMessageBox.Show("Something went wrong", "An error has occured while joining the event\n Error code : " + response.ReasonPhrase, MessageBoxButton.OK, MessageBoxImage.Error); } } else { WpfMessageBox.Show("No role specified", "Please fill in your role for this event!", MessageBoxButton.OK, MessageBoxImage.Question); } DataGrid.FillDataGrid(); Close(); }