protected async void btnSubmit_Click(object sender, EventArgs e) { // create a review entity UserReview userreview = new UserReview() { StrUsername = "******", IntRatingId = Convert.ToByte(ddlRating.SelectedValue), StrComment = txtComment.Text }; try { // add the review to the database await _client.PostAsync("UserReviews", userreview); } finally { Response.Redirect(Request.RawUrl + "?Load=Load"); } }
private async void add_Click(object sender, EventArgs e) { // Create a Prescription entity. Prescription prescription = new Prescription() { PatientID = _patientID, IssueDate = issueDatePicker.Value.Date, Description = descriptionTextBox.Text, RepeatCount = 0 }; //// Add the Prescription entity to the DataContext object. //_db.Prescriptions.InsertOnSubmit(prescription); //// Add the prescription description to addedPrescriptionsListBox. //addedPrescriptionsListBox.Items.Add(prescription.Description); //// Clear the description text box, ready for another prescription. //descriptionTextBox.Clear(); //descriptionTextBox.Focus(); // add the prescription to the database try { await _client.PostAsync("prescriptions", prescription); // Add the prescription description to addedPrescriptionsListBox. addedPrescriptionsListBox.Items.Add(prescription.Description); // Clear the description text box, ready for another prescription. descriptionTextBox.Clear(); descriptionTextBox.Focus(); } catch { MessageBox.Show("Unable to add a prescription - please try again."); } }