Here, we have to read the values from the text boxes related to shipping information and match them with the fields of Orders.cs to build an object. OrdersProducts is an array representing the model class, OrdersProducts.cs. Every order can have multiple products associated with it.
The following code implements order objects:
// 1. Build order object to match the model class Orders.cs.
var order = {
Customerid: customerId,
CustomerStreetaddress: $('#txtStreetAdd').val(),
Customercity: $('#txtCity').val(),
Customerstate: $('#txtState').val(),
Customerpostalcode: $('#txtPostalCode').val(),
Customercountry: $('#txtCountry').val(),
OrdersProducts: new Array()
};