public void DeleteCustomerProfile(string customerId) { var customer = _customerRepository.FindCustomerProfileById(customerId); if (customer == null) { throw new ObjectNotFoundException($"Customer profile with id={customerId} not found"); } _customerRepository.Delete(customer); }
public void DeleteUser(string userId) { var user = _userManager.FindById(userId); if (user == null) { throw new ObjectNotFoundException($"User with id={userId} not found"); } if (user.CustomerProfile != null) { _customerRep.Delete(user.CustomerProfile); } if (user.EmployeeProfile != null) { _employeeRep.Delete(user.EmployeeProfile); } _userManager.Delete(user); }