public ActionResult <TCRequest> Post(TCRequest request)
        {
            using (HttpClient client = new HttpClient())
            {
                var internal_request = "http://localhost:" + InternalPort.ToString() + "/" + JsonConvert.SerializeObject(request);

                var t = client.GetStringAsync(internal_request);
                t.Wait();
                var internal_response = t.Result;

                return(Ok(internal_response));
            }
        }
示例#2
0
        /// <summary>
        /// Reformats text of manual request input box into json format whenever it is changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void textBox_manReqIn_TextChanged(object sender, TextChangedEventArgs e)
        {
            var textBox = (sender as TextBox);

            try
            {
                var currentManRequest = JsonConvert.DeserializeObject <TCRequest>(textBox.Text);
                textBox.Text       = JsonConvert.SerializeObject(currentManRequest, Formatting.Indented);
                textBox.Background = Brushes.White;
                if (textBox.Name == "textBox_manReqIn")
                {
                    CurrentManRequest = currentManRequest;
                }
            }
            catch
            {
                textBox.Background = Brushes.LightSalmon;
            }
        }