public async Task <IActionResult> AddToBasket(int productId, int quantity) { var basketId = await _basketViewModelService.GetOrCreateBasketIdAsync(); await _basketService.AddItemToBasket(basketId, productId, quantity); return(Json(await _basketViewModelService.GetBasketItemsCountViewModel(basketId))); }
public async Task <IActionResult> AddToBasket(int productId, int quantity) { // application core projesinde BasketService : IBasketService // AddItemToBasket(int basketId, int catalogItemId, int quantity) var basketId = await _basketViewModelService.GetOrCreateBasketIdAsync(); await _basketService.AddItemToBasket(basketId, productId, quantity); // sepetteki yeni öğe sayısını döndür. return(Json(await _basketViewModelService.GetBasketItemsCountViewModel(basketId))); }
public async Task <IActionResult> AddToBasket(int productId, int quantity) { // application core projesinde BasketService:IBasketService //AddItemToBasket(int basketId, int catologId,int quantity) //sepette varsa adedini güncelle yoksa ekle //sepetteki öğe sayısını döndür var basketId = await _basketViewModelService.GetOrCreateBasketIdAsync(); await _basketService.AddItemToBasket(basketId, productId, quantity); int basketItemsCount = await _basketService.BasketItemsCount(basketId); return(Json(await _basketViewModelService.GetBasketItemsCountViewModel(basketId))); }
public async Task <IViewComponentResult> InvokeAsync() { var basketId = await _basketViewModelService.GetOrCreateBasketIdAsync(); var vm = await _basketViewModelService.GetBasketItemsCountViewModel(basketId); return(View(vm)); }