Code2Gether-Discord / Congo

Generic web store learning project that consists of three ASP.NET Core projects
https://code2gether-congo.azurewebsites.net/
11 stars 2 forks source link

Will require api endpoint to fetch the cart items #75

Closed chrisK00 closed 2 years ago

chrisK00 commented 2 years ago

On a CartController there should be a Get endpoint that returns a Cart including its CartItems and then include the Product inside the CartItem.

We need a response model for a cart that should have:

and a response model for a Cart Item that should have:

You can configure mapster to automatically make the calculations when mapping from a Cart to a CartResponse and CartItem to CartItemResponse.

  1. Mapster has a global TypeAdapterConfig.GlobalSettings and a .Scan method that can be used to scan the assembly for mappings
  2. Create a Mapping class for an entity and the class should implement IRegister
  3. Inside the Register method the syntax for adding a mapping is like automapper, config.NewConfig<FromType, ToType>().Map(destination => , source => )

child of #70