public string SaveOrder(Order order) { try { using (var db = new NORTHWINDEntities()) { var newOrder = new DataModels.Order() { OrderDate = DateTime.Now, EmployeeID = 3, CustomerID = "GREAL" }; db.Orders.Add(newOrder); db.SaveChanges(); var newOrderDetail = new Order_Detail() { OrderID = newOrder.OrderID, ProductID = order.ProductID, UnitPrice = order.UnitPrice, Quantity = order.Quantity, Discount = 0 }; db.Order_Details.Add(newOrderDetail); db.SaveChanges(); return("Inserted successfully"); } } catch (Exception e) { throw new FaultException <ServiceExecptions>(new ServiceExecptions() { Reason = e.Message }); } }
private void detach_Orders(Order entity) { this.SendPropertyChanging(); entity.Address = null; }
private void attach_Orders(Order entity) { this.SendPropertyChanging(); entity.Address = this; }