public ActionResult OnPost() { if (!string.IsNullOrEmpty(Input.Country) && !Countries.Any(x => x.Key == Input.Country)) { ModelState.AddModelError(nameof(Input.Country), "Selected country is invalid."); } if (ModelState.IsValid) { _ontraForms.ServerPost("p2c20557f12", new Dictionary <string, object> { { "email", Input.Email }, { "f1337", Input.Gender == "Man" ? 2 : 1 }, { "firstname", Input.FirstName }, { "lastname", Input.LastName }, { "f1336", Input.Age }, { "country", Input.Country }, { "office_phone", Input.Telephone }, { "f1370", Input.Goals }, // Strategy Goals { "f1371", Input.Issues }, // Strategy Issues { "f1372", Input.Steps }, // Strategy Steps { "f1373", Input.Transform }, // Strategy Why { "f1556", Input.RatePain }, // Rate Pain { "f1557", Input.RateDesire }, // Rate Desire { "f1558", Input.RateUrgency }, // Rate Urgency { "f1559", Input.Income }, // Income Goal }); return(RedirectToPage("/coaching-sent")); } // If we get here, something went wrong. Display errors. return(Page()); }
public async Task <ActionResult> OnPost() { if (ModelState.IsValid) { if (Input?.Password != _config.Value.AdminPassword) { ModelState.AddModelError("Input.Password", "Wrong password."); } else { var contact = await _ontraContacts.SelectAsync(Input.Email).ConfigureAwait(false); if (contact == null) { ModelState.AddModelError("Input.Email", "Contact not found in Ontraport."); } else { _ontraPostForms.ServerPost("p2c20557f60", new ApiCustomContact() { Email = Input.Email, GodConnectionNotes = Input.Notes }.GetChanges()); return(new LocalRedirectResult("/coaching-sent")); } } } return(Page()); }
public void PostForm(string email, string firstName) { _ontraPostForms.ServerPost("my-form-id", new ApiContact() { Email = email, FirstName = firstName }.GetChanges()); }
public async Task <ActionResult> OnPostAsync() { if (!string.IsNullOrEmpty(Input.Country) && !Countries.Any(x => x.Key == Input.Country)) { ModelState.AddModelError(nameof(Input.Country), "Selected country is invalid."); } if (ModelState.IsValid) { var fileName = await _uploadHelper.UploadClientPicture(Input.Picture !, Input.Email, ModelState, "Picture").ConfigureAwait(false); if (fileName != null) { // Post Ontraport form. _ontraForms.ServerPost("p2c20557f10", new Dictionary <string, object> { { "email", Input.Email },