public static CarrierInvoiceProfileFeeProvision Save(CarrierInvoiceProfileFeeProvision provision) { if (provision.ID == 0) DbContextHelper.DbContext.Add(provision); DbContextHelper.DbContext.SaveChanges(); return provision; }
public static void Delete(int id) { CarrierInvoiceProfileFeeProvision provision = new CarrierInvoiceProfileFeeProvision { ID = id }; // Now attach the category stub object to the "Categories" set. // This puts the Entity into the context in the unchanged state, // This is same state it would have had if you made the query DbContextHelper.DbContext.AttachTo("CarrierInvoiceProfileFeeProvisions", provision); // Do the delete the category DbContextHelper.DbContext.DeleteObject(provision); // Apply the delete to the database DbContextHelper.DbContext.SaveChanges(); }