public void AddToCart(Shoes shoes, int amount) { OrderBL orderBL = new OrderBL(); order.OrderUser = new Customer(); order.OrderItem = new Shoes(); order.ListShoes = new List <Shoes>(); order.OrderUser.UserID = customer.UserID; order.OrderItem.ShoesId = shoes.ShoesId; if (customerBL.GetCustomerByID(customer.UserID).UserShoppingCart) { try { if (orderBL.AddToShoppingcart(order, amount)) { Console.WriteLine("Add to cart successfully"); } else { Console.WriteLine("Products already in the cart"); } } catch (System.Exception) { Console.WriteLine("XXX"); throw; } } else { // Console.WriteLine(customer.UserID); customerBL.UpdateStatusShoppingCartById(false, customer.UserID); // set userShopping cart to 1 order.OrderStatus = 0; try { if (orderBL.CreateShoppingCart(order, amount)) { Console.WriteLine("Add to cart successfully"); } } catch (System.Exception) { Console.WriteLine("XXX1"); throw; } } Console.WriteLine("press any key to continue"); Console.ReadKey(); }