eShopOnContainers icon indicating copy to clipboard operation
eShopOnContainers copied to clipboard

Basket Service - GetBasket - called too often in MVC Client

Open ChrisFist opened this issue 3 years ago • 1 comments

When showing the basket content of a user by clicking on his card the view /Card/Index is invoked which requires as View Output to the model variable a basket. Hence in related action controller CartController.cs you find:

var vm = await _basketSvc.GetBasket(user); return View(vm);

calling the GetBasket service for the connected user. But this is not needed because the /Card/Index calls ViewComponent Cardlist which calls as well the GetBasket service. This is sufficient and the GetBasket call in Index Action of CartController.cs is not needed.

Proposed changes in CartController.cs: image

and change in /Card/Index.cshtml

image

ChrisFist avatar Aug 24 '22 13:08 ChrisFist

I want to pick this up

ravividap avatar Aug 27 '22 06:08 ravividap

I am closing this issue since it's not an issue, this piece of code will be used to get the data based on the identity of the user. However please feel free to post here.

erjain avatar Oct 31 '22 11:10 erjain