public static CarrierInvoiceProfileFeeSchedule Save(CarrierInvoiceProfileFeeSchedule fee) { if (fee.ID == 0) DbContextHelper.DbContext.Add(fee); DbContextHelper.DbContext.SaveChanges(); return fee; }
public static void Delete(int id) { CarrierInvoiceProfileFeeSchedule fee = new CarrierInvoiceProfileFeeSchedule { 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("CarrierInvoiceProfileFeeSchedules", fee); // Do the delete the category DbContextHelper.DbContext.DeleteObject(fee); // Apply the delete to the database DbContextHelper.DbContext.SaveChanges(); }