Exemplo n.º 1
0
        public IActionResult AddMultipleToShoppingCart([FromServices] CartRelatedService service, int productid, int quantity, bool?buyNow)
        {
            var productselected = db.Products.FirstOrDefault(x => x.ProductId == productid);

            string customerid = Request.Cookies["customerId"];

            string sessionid = Request.Cookies["sessionId"];

            if (sessionid == null)
            {
                customerid = "0";
            }

            if (productselected != null)
            {
                service.AddToCart(productselected, productid, quantity, customerid, sessionid);
            }
            if (buyNow == true)
            {
                return(RedirectToAction("Index", "Cart"));
            }
            else
            {
                return(RedirectToAction("ProductDetailPage", "Gallery", new { id = productid }));
            }
        }
Exemplo n.º 2
0
        public IActionResult AddSimilarToShoppingCart([FromServices] CartRelatedService service, int productid)
        {
            var productselected = db.Products.FirstOrDefault(x => x.ProductId == productid);

            string customerid = Request.Cookies["customerId"];

            string sessionid = Request.Cookies["sessionId"];

            if (sessionid == null)
            {
                customerid = "0";
            }

            if (productselected != null)
            {
                service.AddToCart(productselected, productid, 1, customerid, sessionid);
            }
            return(RedirectToAction("ProductDetailPage", "Gallery", new { id = productid }));
        }
Exemplo n.º 3
0
        public IActionResult AddInDesign([FromServices] CartRelatedService service, int productid)
        {
            var productselected = db.Products.FirstOrDefault(x => x.ProductId == productid);

            string customerid = Request.Cookies["customerId"];

            string sessionid = Request.Cookies["sessionId"];

            if (sessionid == null)
            {
                customerid = "0";
            }

            if (productselected != null)
            {
                service.AddToCart(productselected, productid, 1, customerid, sessionid);
            }
            return(RedirectToAction("DesignAndIllustration", "Gallery"));
        }