Last post Jun 04, 2020 02:02 AM by Evern
Jun 03, 2020 08:29 PM|jorgeDLG|LINK
Hi. I'm very new coding, so the most practical & easy solution will be fine for my by now.
I'm doing a very vanilla net core 3.1 mvc academic
project and I need to implement a shopping cart.
My involved Models are:
My Uses Cases are 2:
In both cases I suppose I have to use ajax requests.
If the user is authenticated the cart has to be loaded (If the purchase isn't completed). I guess I will need some init rutine to load or create the cart.
On the navbar I have a counter that has to show the nº of items in the cart.
I see at least 3 differents aproaches but I don't know which one could I use( I accept new ones):
I remember that I don't have so much experience (I messed up beyond scaffolded Model > Controller > View) and the simplest and closest solution to the vanilla project, will be fine for me.
Thanks in advance.
Jun 04, 2020 02:02 AM|Evern|LINK
If I were to make a choice, I would choose the third option. Adding the goods to the shopping cart with instrument, the shopping cart will record every information of the goods (product name, price, quantity, etc.), generate an order after the user buys,
in the cart class only design the attributes that need to be recorded in the shopping cart, in the CartService can handle the corresponding method (home page shows the number of goods in the shopping cart, handle the purchase business, etc.), and CartController
is responsible for handling user requests and system response.