public void onDeleteSalesOrderLine(SalesOrderLine line) { if (line != null) { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure you wish to delete this item?", "Confirm Delete", System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { int salesOrderLineid = line.salesOrderLinesID; SalesOrderLine lineToRemove = (SalesOrderLine)SalesOrderLines.Single(p => p.salesOrderLinesID == salesOrderLineid); db.SalesOrderLines.Remove(lineToRemove); db.SaveChanges(); SalesOrders = UpdateSalesOrdersCollection(SalesOrders); } } }
public void onAddSalesOrderLine(SalesOrderLine line) { var newSalesOrderLine = line; if (newSalesOrderLine != null) NewSalesOrder.SalesOrderLines.Add(newSalesOrderLine); }