// to add a new order row to an existing order public OrderRow AddOrderRow(OrderRow orderRow) { try { int newId = orderRows.Count.Equals(0) ? 1 : orderRows.Max(o => o.OrderRowId) + 1; orderRow.OrderRowId = newId; orderRows.Add(orderRow); return(orderRow); } catch (Exception ex) { throw new ApplicationException( "Could not add the order row", ex); } }
// To remove an order row instance from the orderRows collection in the Data class public bool RemoveOrderRow(OrderRow orderRow) { return(orderRows.Remove(orderRow)); }