Exemplo n.º 1
0
        public ActionResult AddToCart(int id)
        {
            CartItem basket = Session["basket"] == null ? new CartItem() : Session["basket"] as CartItem;

            Product eklenecekUrun = productService.GetById(id);
            Cart    cart          = new Cart();

            cart.ID          = eklenecekUrun.Id;
            cart.UnitPrice   = eklenecekUrun.UnitPrice;
            cart.ImagePath   = eklenecekUrun.ImagePath;
            cart.ProductName = eklenecekUrun.ProductName;
            basket.AddProduct(cart);
            Session["basket"] = basket;

            return(RedirectToAction("Index"));
        }