Beispiel #1
0
        public IActionResult Cart()
        {
            int userId = Convert.ToInt32(User.Claims.FirstOrDefault(c => c.Type == "UserID")?.Value);

            _cartViewModel.cart = _cartLogic.GetProductsFromCart(userId);
            return(View(_cartViewModel));
        }
Beispiel #2
0
 public IActionResult PlaceOrder(CartViewModel viewModel)
 {
     Order order = new Order();
     order.Cart = new Cart();
     order.User.UserID = Convert.ToInt32(User.Claims.FirstOrDefault(c => c.Type == "UserID")?.Value);
     order.Cart = _cartLogic.GetProductsFromCart(order.User.UserID);
     _orderLogic.PlaceOrder(order);
     _orderLogic.DeletCartTable(order);
     return RedirectToAction("Order");
 }