protected async void BindContactGridView() { List<Contact> listOfContacts = new List<Contact>(); var query = new ParseQuery<ParseObject>("Contacts"); IEnumerable<ParseObject> results = await query.FindAsync(); foreach (var item in results) { Contact newContact = new Contact(); newContact.FirstName = item.Get<string>("FirstName"); newContact.LastName = item.Get<string>("LastName"); newContact.EmailAddress = item.Get<string>("EmailAddress"); newContact.Message = item.Get<string>("Message"); listOfContacts.Add(newContact); } gvContacts.DataSource = listOfContacts; gvContacts.DataBind(); }
protected async void btnSend_Click(object sender, EventArgs e) { Contact newContact = new Contact(); newContact.EmailAddress = txtEmail.Text; newContact.FirstName = txtFName.Text; newContact.LastName = txtLName.Text; newContact.Message = txtMessage.Text; var contactObject = new ParseObject("Contacts"); contactObject["EmailAddress"] = newContact.EmailAddress; contactObject["FirstName"] = newContact.FirstName; contactObject["LastName"] = newContact.LastName; contactObject["Message"] = newContact.Message; if (radDined.SelectedValue == "Yes") { Survey newSurvey = new Survey(); newSurvey.Food = radListFood.SelectedValue; newSurvey.Value = radListValue.SelectedValue; newSurvey.FavoriteDish = txtFavDish.Text; newSurvey.LeastFavoriteDish = txtBadDish.Text; newSurvey.Critique = txtWhyDislike.Text; newSurvey.AddToMenu = txtAddMenu.Text; var surveyObject = new ParseObject("Survey"); surveyObject["EmailAddress"] = newContact.EmailAddress; surveyObject["Food"] = newSurvey.Food; surveyObject["Value"] = newSurvey.Value; surveyObject["FavoriteDish"] = newSurvey.FavoriteDish; surveyObject["LeastFavoriteDish"] = newSurvey.LeastFavoriteDish; surveyObject["Critique"] = newSurvey.Critique; surveyObject["AddToMenu"] = newSurvey.AddToMenu; surveyObject["ContactID"] = contactObject; await surveyObject.SaveAsync(); } else await contactObject.SaveAsync(); Response.Redirect("~/ThankYou.aspx"); }