protected void btnSubmit_Click(object sender, EventArgs e) { try { string inputUrl = "http://localhost:59568/Api/Home/Post"; UserPages objdata = new UserPages(); objdata.username = drpUsers.SelectedValue.ToString(); objdata.page1 = Page1LinkToggle.Checked; objdata.page2 = Page2LinkToggle.Checked; objdata.page3 = Page3LinkToggle.Checked; string data = JsonConvert.SerializeObject(objdata); string result = CallWebService.POST(inputUrl, data); if (result == "inserted") { lblresult.InnerText = "Saved Successfully!!!"; } else if (result == "updated") { lblresult.InnerText = "Updated Successfully!!!"; } else { lblresult.InnerText = "Error"; } lblresult.Style.Add("display", "block"); } catch (Exception ex) { throw ex; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { string inputUrl = "http://localhost:59568/Api/Values/Post"; string data = "{ \"username\": " + '"' + txtUsername.Text + '"' + " ,\"email\":" + '"' + txtEmailid.Text.ToString() + '"' + ",\"password\":" + '"' + txtPassword.Text.ToString() + " }"; string result = CallWebService.POST(inputUrl, data); if (result == "success") { lblresult.Style.Add("display", "block"); } else { lblresult.InnerText = "New User Registration Error"; lblresult.Style.Add("display", "block"); } } catch (Exception ex) { throw ex; } }