示例#1
0
        public bool Update(Domain.RibbonButton entity)
        {
            var original = _ribbonButtonRepository.FindById(entity.RibbonButtonId);
            var result   = true;

            using (UnitOfWork.Build(_ribbonButtonRepository.DbContext))
            {
                result = _ribbonButtonRepository.Update(entity);
                //依赖
                _dependencyService.Update(entity);
                //localization
                _localizedLabelService.Update(entity.Label.IfEmpty(""), "LocalizedName", entity.RibbonButtonId, this._appContext.BaseLanguage);
                _localizedLabelService.Update(entity.Description.IfEmpty(""), "Description", entity.RibbonButtonId, this._appContext.BaseLanguage);
                //assigning roles
                if (original.AuthorizationEnabled || !entity.AuthorizationEnabled)
                {
                    _eventPublisher.Publish(new AuthorizationStateChangedEvent
                    {
                        ObjectId = new List <Guid> {
                            entity.RibbonButtonId
                        }
                        ,
                        State = false
                        ,
                        ResourceName = RibbonButtonDefaults.ModuleName
                    });
                }
            }
            return(result);
        }
示例#2
0
        public Domain.RibbonButton FindById(Guid id)
        {
            var data = _ribbonButtonRepository.FindById(id);

            if (data != null)
            {
                WrapLocalizedLabel(data);
            }
            return(data);
        }