Exemplo n.º 1
0
        public async Task <Trigger> UpdateAsync(Trigger trigger)
        {
            VerifyManagementPermission();
            trigger.SiteId = GetCurrentSiteId();
            await ValidateTriggerAsync(trigger);

            if (!HasPermission(Permission.ManageVendorCodes) ||
                !HasPermission(Permission.ManageTriggerMail) ||
                !HasPermission(Permission.ManageAvatars))
            {
                var currentTrigger = await _triggerRepository.GetByIdAsync(trigger.Id);

                if (!HasPermission(Permission.ManageVendorCodes))
                {
                    trigger.AwardVendorCodeTypeId = currentTrigger.AwardVendorCodeTypeId;
                }
                if (!HasPermission(Permission.ManageAvatars))
                {
                    trigger.AwardAvatarBundleId = currentTrigger.AwardAvatarBundleId;
                }
                if (!HasPermission(Permission.ManageTriggerMail))
                {
                    trigger.AwardMail        = currentTrigger.AwardMail;
                    trigger.AwardMailSubject = currentTrigger.AwardMailSubject;
                }
            }
            return(await _triggerRepository.UpdateSaveAsync(GetClaimId(ClaimType.UserId),
                                                            trigger));
        }
Exemplo n.º 2
0
        public async Task <Trigger> UpdateAsync(Trigger trigger)
        {
            VerifyManagementPermission();
            trigger.SiteId = GetCurrentSiteId();
            await ValidateTriggerAsync(trigger);

            return(await _triggerRepository.UpdateSaveAsync(GetClaimId(ClaimType.UserId),
                                                            trigger));
        }