public void addRSVP(Models.EventRSVP rsvp) { if (expires_in <= DateTime.Now) { getTokens(); } var client = new RestClient("https://www.kresgefor98.com/rest/CFCandidate/"); client.AddDefaultHeader("Authorization", "Bearer " + access_token); client.AddDefaultHeader("Content-type", "application/json"); var request = new RestRequest("events", Method.POST); request.RequestFormat = DataFormat.Json; request.AddJsonBody(rsvp); client.Execute(request); }
void BtnSendRsvp_Clicked(object sender, EventArgs e) { if (rsvpName.Text.Length <= 0) { DisplayAlert("Error", "Must enter name of person attending.", "OK"); } if (numberAttending.Value < 1) { DisplayAlert("Error", "Must enter number of attendees.", "OK"); } Models.EventRSVP rsvp = new Models.EventRSVP() { name = rsvpName.Text, numbercoming = (int)numberAttending.Value, contactemail = contactEmail.Text, contactphone = contactPhone.Text, eventId = rsvpEventId }; Services services = new Services(); services.addRSVP(rsvp); Navigation.PopAsync(); }