public async Task RemoveAsync(int triggerId) { VerifyManagementPermission(); if (await _triggerRepository.HasDependentsAsync(triggerId)) { throw new GraException("Trigger has dependents"); } var trigger = await _triggerRepository.GetByIdAsync(triggerId); trigger.IsDeleted = true; trigger.SecretCode = null; trigger.BadgeIds = new List <int>(); trigger.ChallengeIds = new List <int>(); await _triggerRepository.UpdateSaveAsync(GetClaimId(ClaimType.UserId), trigger); var requireSecretCode = await _siteLookupService.GetSiteSettingBoolAsync( GetCurrentSiteId(), SiteSettingKey.Events.RequireBadge); if (requireSecretCode == false) { await _eventRepository.DetachRelatedTrigger(triggerId); } }
public async Task RemoveAsync(int triggerId) { VerifyManagementPermission(); if (await _triggerRepository.HasDependentsAsync(triggerId)) { throw new GraException("Trigger has dependents"); } var trigger = await _triggerRepository.GetByIdAsync(triggerId); trigger.IsDeleted = true; trigger.BadgeIds = new List <int>(); trigger.ChallengeIds = new List <int>(); await _triggerRepository.UpdateSaveAsync(GetClaimId(ClaimType.UserId), trigger); }