public IActionResult Cart() { int userId = Convert.ToInt32(User.Claims.FirstOrDefault(c => c.Type == "UserID")?.Value); _cartViewModel.cart = _cartLogic.GetProductsFromCart(userId); return(View(_cartViewModel)); }
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"); }