Exemplo n.º 1
0
        public async Task <ActionResult> AddToCart(int id)
        {
            var productDTO = await _productService.GetAsync(id);

            if (productDTO == null)
            {
                return(HttpNotFound());
            }

            var productVM = Mapper.Map <ProductVM>(productDTO);

            GetCart.Add(productVM);

            Thread.Sleep(400);
            return(Json(new
            {
                IsSuccess = true,
                Quantity = GetCart.Count
            },
                        JsonRequestBehavior.AllowGet));
        }