/// <inheritdoc/> public async Task <bool> DeleteProfileByIdAsync(Guid id) { var profileFound = await _profileContext.Profiles.FirstOrDefaultAsync(p => p.Id == id); if (profileFound == null) { _logger.Error(ProfileConstants.PROFILE_NOT_FOUND); return(false); } _profileContext.Remove(profileFound); await _profileContext.SaveChangesAsync(new CancellationToken()); // Publish event on user deleted (profile + account). await _userDeletedEventProducer.Publish(new UserDTO { ProfileId = profileFound.Id, AccountId = profileFound.AccountId, }); return(true); }
/// <inheritdoc/> public async Task <bool> DeleteProfileByIdAsync(Guid id) { var profileFound = await _profileContext.Profiles.FirstOrDefaultAsync(p => p.Id == id); if (profileFound == null) { _logger.Error(ProfileConstants.PROFILE_NOT_FOUND); return(false); } _profileContext.Remove(profileFound); await _profileContext.SaveChangesAsync(new CancellationToken()); return(true); }