public ActionResult Create_OrderDetail(OrderDetailViewModel orderDetail, int id) { if (orderDetail != null && ModelState.IsValid) { var target = new Order_Detail(); target.OrderID = id; target.ProductID = orderDetail.ProductID; target.Quantity = orderDetail.Quantity; target.UnitPrice = orderDetail.UnitPrice; context.Order_Details.AddObject(target); context.SaveChanges(); orderDetail.UIID = id.ToString() + target.ProductID; } return Json(new[] { orderDetail }.ToDataSourceResult(new DataSourceRequest(), ModelState)); }
/// <summary> /// Deprecated Method for adding a new object to the Order_Details EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToOrder_Details(Order_Detail order_Detail) { base.AddObject("Order_Details", order_Detail); }
/// <summary> /// Create a new Order_Detail object. /// </summary> /// <param name="orderID">Initial value of the OrderID property.</param> /// <param name="productID">Initial value of the ProductID property.</param> /// <param name="unitPrice">Initial value of the UnitPrice property.</param> /// <param name="quantity">Initial value of the Quantity property.</param> /// <param name="discount">Initial value of the Discount property.</param> public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, global::System.Int32 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount) { Order_Detail order_Detail = new Order_Detail(); order_Detail.OrderID = orderID; order_Detail.ProductID = productID; order_Detail.UnitPrice = unitPrice; order_Detail.Quantity = quantity; order_Detail.Discount = discount; return order_Detail; }