public IActionResult Insert120(int coordX) { TimeSpan now = DateTime.Now.Subtract(new DateTime(1970, 1, 1, 0, 0, 0)); int epoch = (int)now.TotalSeconds; StringBuilder query = new StringBuilder("use pixelappDB; insert into pixels(!id, !coordX, !coordY, !color, !updatedAt) values"); for (var i = 0; i <= 120; i++) { int id = (coordX + 1) + i * 161; query.Append("(" + id + ", " + coordX + ", " + i + ", '#FFFFFF', " + epoch + ")"); if (i == 120) { query.Append(";"); } else { query.Append(","); } } var endpoint = "http://40.117.152.157/nodedb1"; var endPointObj = new RequesterEndpointObject { Query = query.ToString(), EndPoint = endpoint }; //return ExecuteQueryToRequester(endPointObj).Result; return(ExecuteQuery(query.ToString()).Result); }
public async Task <IActionResult> ExecuteQueryToRequester([FromBody] RequesterEndpointObject requesterEndpoint) { var signatureEndpoint = requesterEndpoint.EndPoint + "/api/Requester/SignQuery"; var executionEndpoint = requesterEndpoint.EndPoint + "/api/Requester/ExecuteQuery"; try { var signatureRequest = HttpHelper.ComposeWebRequestPost(signatureEndpoint); var signatureResponse = await HttpHelper.CallWebRequestNoSSLVerification(signatureRequest, requesterEndpoint.Query); var response = JsonStringNavigator.GetDeeper(signatureResponse, "response"); var executionRequest = HttpHelper.ComposeWebRequestPost(executionEndpoint); var executionJson = await Fetch.PostAsync(executionEndpoint, response); var items = JsonConvert.DeserializeObject <ExpandoObject>(executionJson); return(Ok(items)); } catch (Exception e) { throw e; } }