Ejemplo n.º 1
0
        public IActionResult Details(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var product = _productsManager.Find(id);

            if (product == null)
            {
                return(NotFound());
            }

            return(View(product));
        }
Ejemplo n.º 2
0
        public async Task <JsonResult> AddProduct(string id)
        {
            bool result  = false;
            var  product = _productsManager.Find(id);

            if (product != null)
            {
                if (!_cartsManager.IsProductInCart(User, product))
                {
                    await _userProfileManager.AddProductToCart(User, product);

                    result = true;
                }
            }

            return(Json(result));
        }