public bool POSTGETkeyData(string url) { var obj = new Doctor_login() { doctorid = "9999999998", }; var myContent = JsonConvert.SerializeObject(obj); var buffer = System.Text.Encoding.UTF8.GetBytes(myContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage result = _httpClient.PostAsync(url, byteContent).Result; if (result.StatusCode == System.Net.HttpStatusCode.Created) { return(true); } string returnValue = result.Content.ReadAsStringAsync().Result; JObject o = JObject.Parse(returnValue); blockcode = Convert.ToString(o["blockchain"]["blockcode"]); TextBox1.Text = blockcode; return(true); }
protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.Session["drId"] != null || HttpContext.Current.Session["empId"] != null) { if (Session["Role"].ToString() == "Doctor") { _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2MTA5NjAwOTEsImV4cCI6MTY0MjUxNzY5MSwiYXVkIjoiNjAwNTRjYjM1M2NhZDUwMDI0ZDFlMjFiIiwiaXNzIjoiZ29vZ2xlLmNvbSJ9.puMjI9I_suRdDhSqnMsXfTYIL5Ag9ldKt4uYvhyMKKY"); var obj = new Doctor_login() { doctorid = Session["drId"].ToString() }; var myContent = JsonConvert.SerializeObject(obj); var buffer = System.Text.Encoding.UTF8.GetBytes(myContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage result = _httpClient.PostAsync("https://medimok-m.herokuapp.com/doctor/employeeinfo", byteContent).Result; if (result.StatusCode == System.Net.HttpStatusCode.OK) { string returnValue = result.Content.ReadAsStringAsync().Result; DataTable dtNewtonSoftLinq = ConvertJsonToDatatableLinq(returnValue); GridView1.DataSource = dtNewtonSoftLinq; GridView1.DataBind(); } } else if (Session["Role"].ToString() == "Employee") { TextBox1.Visible = false; Button4.Visible = false; btnGrid1Visible.Visible = false; } } }