private void Create(int customerId) { using (BypassPropertyChecks) { Id = -1; CustomerId = customerId; OrderDate = DateTime.Today; LastEdit = DateTime.Today; } OrderLineItems = DataPortal.CreateChild <OrderLineItems>(); BusinessRules.CheckRules(); }
private void Fetch(int id, [Inject] DataAccess.IOrderDal dal) { var data = dal.Fetch(id); data.Read(); using (BypassPropertyChecks) { Id = data.GetInt32("Id"); CustomerId = data.GetInt32("CustomerId"); OrderDate = data.GetDateTime("OrderDate"); LastEdit = data.GetDateTime("OrderEditDate"); } OrderLineItems = DataPortal.FetchChild <OrderLineItems>(id); }
private void Delete(int id, [Inject] DataAccess.IOrderDal dal) { dal.Delete(id); // cascading delete removed all data, so recreate child collection OrderLineItems = DataPortal.CreateChild <OrderLineItems>(); }