Need to display total amount and total quantity of shopping cart

0
I am creating food ordering app where in the shopping cart I want to display the total price of the food and total quantity. I have created 2 entities in domain models which I have added in screenshot. 1) orderlIine and Cart entity.   There is a cart page which is displaying the order Line food items added the cart and its attributes like price and quantity. I want o display the total amount of entire cart. How do i display it on the same cart page? I have added the screenshot of domain model and pages below. If there is any other way to do it, please suggest that as well.   Domain Model:   Cart page:     
asked
1 answers
0

Hi Harsh,

 

In your domain model, you denormalized the data. Did you do this on purpose? If not for performance reasons, consider a Product entity and an Order entity.

 

If you keep the domain model as is, the answer is below:

The amount of products in your Cart equals the Count (Aggregate list Action) of the list over the OrderLibe_Cart association. The TotalAmount is the Sum Aggregate list Action) of the list over the OrderLibe_Cart association.

 

Go Make It

 

answered