public bool AddOrder(Order order, List<Cart_Product> cpl) { try { foreach(Cart_Product cp in cpl){ Order_Product op = new Order_Product(); op.OrderID=order.ID; op.ProductID=cp.ProductID; op.Quantity = cp.Quantity; order.Order_Product.Add(op); } new OrderRep().AddOrder(order); return true; } catch (Exception) { return false; } }
/// <summary> /// Deprecated Method for adding a new object to the Order_Product EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToOrder_Product(Order_Product order_Product) { base.AddObject("Order_Product", order_Product); }
/// <summary> /// Create a new Order_Product object. /// </summary> /// <param name="orderID">Initial value of the OrderID property.</param> /// <param name="productID">Initial value of the ProductID property.</param> /// <param name="quantity">Initial value of the Quantity property.</param> public static Order_Product CreateOrder_Product(global::System.Guid orderID, global::System.Guid productID, global::System.Int32 quantity) { Order_Product order_Product = new Order_Product(); order_Product.OrderID = orderID; order_Product.ProductID = productID; order_Product.Quantity = quantity; return order_Product; }