public void ShopingCart() { while (true) { // Console.Clear(); OrderBL orderBL = new OrderBL(); List <Item> shoppingCart = new List <Item>(); shoppingCart = orderBL.ShowShoppingCartByUserID(user.UserID); if (shoppingCart == null) { Console.ReadKey(); break; } double total = 0; if (shoppingCart.Count <= 0) { Console.WriteLine("Chưa có sản phẩm"); Console.WriteLine("Nhấn phím bất kì để tiếp tục"); Console.ReadKey(); break; } else { Console.WriteLine($"Bạn có {shoppingCart.Count} loại sản phẩm trong giỏ hàng"); var table = new ConsoleTable("ID", "Tên Đồ Uống", "Size", "Giá"); foreach (var item in shoppingCart) { total = total + (double)item.ItemPrice; table.AddRow(item.ItemID, item.ItemName, item.ItemSize, FormatCurrency(item.ItemPrice)); } table.AddRow("", "", "", ""); table.AddRow("Tổng tiền", "", "", FormatCurrency(total)); table.Write(); Console.WriteLine(); string[] choice = { "Thanh toán", "Xóa đồ uống khỏi giở hàng", "Thoát" }; short choose = Extend.MenuDetails("Menu", choice); string pay; switch (choose) { case 1: pay = Extend.OnlyYN("Bạn có muốn thanh toán? (Y/N): "); if (pay == "Y") { CreateOrder(total); } continue; case 2: Console.Write("Nhập mã đồ uống bạn muốn xóa: "); int itemID; bool b = Int32.TryParse(Console.ReadLine(), out itemID); if (!b) { Console.WriteLine("Bạn chỉ được nhập số. Nhấn nút bất kì để quay lại"); Console.ReadKey(); continue; } bool y = false; foreach (var item in shoppingCart) { if (item.ItemID == itemID) { y = true; } } if (y) { string dete = Extend.OnlyYN("Sản phẩm sẽ bị xóa?(Y/N): "); if (dete == "Y") { orderBL.DeleteItemInShoppingCartByItemID(itemID); } } else { Console.WriteLine("Không có sản phẩm này trong giỏ hàng"); Console.WriteLine("Nhấn phím bất kì để tiếp tục"); Console.ReadKey(); } continue; } break; } } }