Skip to Content
Building RESTful Web Services with .NET Core
book

Building RESTful Web Services with .NET Core

by Gaurav Aroraa, Tadit Dash
May 2018
Intermediate to advanced
334 pages
7h 25m
English
Packt Publishing
Content preview from Building RESTful Web Services with .NET Core

Pushing cart items into an order object as an array

Populating the OrdersProducts array is the next step, and this can be done by looping through the cart table's rows and pushing each cart row's details to the array. Inside the loop, read all the necessary values from the row, either from its attribute or td. Remember to form an object and assign the values to field names that match the model class, as follows:

// 2. Push cart items into order object as an array.$('#tblCart tbody tr').each(function () {  order.OrdersProducts.push(  {    Productid: $(this).attr('data-product-id'),    Productname: $(this).find('td.name').html(),    Productprice: $(this).attr('data-price'),    Finalprice: $(this).find('td.price').html().replace('$', ''), Productqty: $(this).find('td.qty').html() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RESTful Web Services with ASP.NET Core 3

Hands-On RESTful Web Services with ASP.NET Core 3

Samuele Resca
Microservices in .NET Core

Microservices in .NET Core

Christian Horsdal Gammelgaard

Publisher Resources

ISBN: 9781788291576Supplemental Content