Can someone help me out how to send these Parameters in asp.net C# for consuming Data on button Click Event in asp.net C#.
{
"ID":"4098",
"BookList":[{
"ANo":"ABCD",
"ALimit":"20.00",
"AMinQ":60.00,
"AMaxQ":120.00,
"OType":"1"
}]
}
protected void BtnOrder_Click(object sender, EventArgs e)
{
try
{
BookOrder OrderRequest = new BookOrder()
{
////I need sent these JSON Foramt or request
};
RestClient restClient = new RestClient("https://myorderdomain.com//OrderService/OrderBook");
restClient.Timeout = -1;
RestRequest request = new RestRequest(Method.POST);
string requestJson = JsonConvert.SerializeObject(OrderRequest);
string datareq = requestJson;
IRestResponse result = restClient.Execute(request.AddJsonBody(datareq));
if (result.Content != "")
{
}
}
catch (Exception ex)
{
}
}
private class BookOrder
{
public string Id { get; set; }
public List<BookDetails> BookList { get; set; }
}
private class BookDetails
{
public string ANo { get; set; }
public string ALimit { get; set; }
public string AMinQ { get; set; }
public string AMaxQ { get; set; }
public string OType { get; set; }
}