public void DeleteCustomer(string customerNumber) { if (customerNumber == null) { throw new ArgumentNullException(nameof(customerNumber)); } if (String.IsNullOrWhiteSpace(customerNumber)) { throw new ArgumentException(nameof(customerNumber)); } if (!customerStore.CustomerExists(customerNumber)) { throw new InvalidOperationException("The customer number does not exist."); } customerStore.Delete(customerNumber); }
public void DeleteCustomer(string customerNumber) { if (customerNumber == null) { throw new ArgumentNullException(nameof(customerNumber)); } if (String.IsNullOrWhiteSpace(customerNumber)) { throw new ArgumentException(nameof(customerNumber)); } if (!customerStore.CustomerExists(customerNumber)) { throw new InvalidOperationException("The customer number does not exist."); } if (tenancyStore.GetCustomerUnits(customerNumber).Any()) { throw new InvalidOperationException("The customer has one or more units reserved and cannot be deleted until all units are released"); } customerStore.Delete(customerNumber); }