Example #1
0
        public ViewResult CheckOut()
        {
            CartViewModel cartViewModel = GetCart();

            Session.Clear();
            string          userId    = User.Identity.GetUserId <string>();
            List <CartLine> cartLines = cartViewModel.CartLineViewModels.Select(c => new CartLine()
            {
                ProductId = c.ProductId, Quantity = c.Quantity, TotalPrice = c.TotalPrice
            }).ToList();

            businessLayer.SaveOrder(cartLines, userId);
            TempData["message"] = string.Format("Your order was successfully registered");
            return(View("DisplayCart", GetCart()));
        }