I am creating an api in .net core api for woocomerce order api, where i am sending the parameters from class object.
But i am getting difficulties for adding multiple item.
public async Task<Response> OrderAdd(OtcOrder order)
{
Response response = new Response();
RestAPI rest = new RestAPI(_wooCommerceBaseUrl, _wooCommerceKey, _wooCommerceSecret);
WCObject wc = new WCObject(rest);
// Instantiate an object of the Order class
Order orders = new Order();
orders.payment_method = order.payment_method;
orders.payment_method_title = order.payment_method_title;
orders.set_paid = order.set_paid;
orders.billing.first_name = order.billing.first_name;
orders.billing.last_name = order.billing.last_name;
orders.billing.address_1 = order.billing.address_2;
orders.billing.address_2 = order.billing.address_2;
orders.billing.city = order.billing.city;
orders.billing.state = order.billing.state;
orders.billing.postcode = order.billing.postcode;
orders.billing.country = order.billing.country;
orders.billing.email = order.billing.email;
orders.billing.phone = order.billing.phone;
orders.shipping.first_name = order.shipping.first_name;
orders.shipping.last_name = order.shipping.last_name;
orders.shipping.address_1 = order.shipping.address_1;
orders.shipping.address_2 = order.shipping.address_2;
orders.shipping.city = order.shipping.state;
orders.shipping.state = order.shipping.state;
orders.shipping.postcode = order.shipping.postcode;
orders.shipping.country = order.shipping.country;
orders.line_items = order.line_items;
// Pass the order object as a parameter to the API call
var res= wc.Order.Add(orders, null);
return response;
}