Beispiel #1
0
        public ActionResult AddToCart(int id)
        {
            var user = JsonConvert.DeserializeObject <Models.UserModel>(HttpContext.Session.GetString("User"));

            var item  = shoppingCartManager.Add(user.Id, id, 1);
            var items = shoppingCartManager.GetAll(user.Id)
                        .Select(t => new Ziggle.WebSite.Models.ShoppingCartItem
            {
                ProductId    = t.ProductId,
                ProductName  = t.ProductName,
                ProductPrice = t.ProductPrice,
                Quantity     = t.Quantity
            })
                        .ToArray();

            return(View(items));
        }