public static Boolean InsertHeaderController(int userId, int paymentId, List <CartModel> allCart, out string errorMessage) { errorMessage = ""; if (CartHandler.returnUserId(userId) == null) { errorMessage = "You don't have any Item in Carts"; return(false); } DateTime date = DateTime.Now; int transId = CartHandler.InsertHeaderHandler(userId, paymentId, date).ID; foreach (CartModel currCart in allCart) { CartHandler.InsertDetailHandler(transId, currCart.productId, currCart.quantity); CartHandler.UpdateMinHandler(currCart.productId, currCart.quantity); CartHandler.deleteItemsInCartHandler(userId, currCart.productId); } return(true); }