C
C#8mo ago
Rodersnow

Any suggenstion how to implement shopping cart feature?

How can I implement a shopping cart feature in my food delibery application, utilizing Vue.js for the frontend and .NET Web API for the backend, allowing authenticated users to add products to their carts?
2 Replies
Nefario
Nefario8mo ago
im assumming you asking for a flow? imo.
Front End :
Add Item
Make new list contain all item
Save all the information related to the Items like, ItemId, Price, Name etc to the new list
Send the list to backend.

Backend :
POST
Get all the list from frontend
Save all the list to the user database.

GET
Get all list from user database
Front End :
Add Item
Make new list contain all item
Save all the information related to the Items like, ItemId, Price, Name etc to the new list
Send the list to backend.

Backend :
POST
Get all the list from frontend
Save all the list to the user database.

GET
Get all list from user database
More or less like this?
kurumi
kurumi8mo ago
I dunno about frontend, but for backend: 0) use CORS Middleware 1) create user. You can use Identity Framework. It is ready solution with many features such as roles, claims. Add a JWT token for Auth 2) create entities to store: sale (one to many with user), cart (one to one with user), product (one to many with sale) 3) install mapper and create some configs or do it manually 4) if you are not using EF Core: create some repositories to easily manage db operations (CRUD) 5) create some services to manage domain logic
5) not necessary step: install mediatr and follow CQRS principles 6) create some filters on you endpoints This is only what I can recommend for now. It can be more additional steps which depends on your domain layer
Want results from more Discord servers?
Add your server