public void Delete(CustomersPnDbAnySql dbContext) { CustomerField customerField = dbContext.CustomerFields.SingleOrDefault(x => x.Id == Id); if (customerField == null) { throw new NullReferenceException($"Could not find customerField with id {Id}"); } customerField.WorkflowState = Constants.WorkflowStates.Removed; if (dbContext.ChangeTracker.HasChanges()) { dbContext.SaveChanges(); } }
public void Update(CustomersPnDbAnySql dbContext) { CustomerField customerField = dbContext.CustomerFields.SingleOrDefault(x => x.Id == Id); if (customerField == null) { throw new NullReferenceException($"Could not find customerField with id {Id}"); } customerField.FieldId = FieldId; customerField.DisplayIndex = DisplayIndex; customerField.FieldStatus = FieldStatus; if (dbContext.ChangeTracker.HasChanges()) { dbContext.SaveChanges(); } }