public DataResult <int> CreatePermissionTypeAction(ResourcePermissionTypeActionModel permissionTypeModel)
        {
            try
            {
                var permissionType = new ResourcePermissionTypeActionEntity
                {
                    Name                   = permissionTypeModel.Name,
                    Description            = permissionTypeModel.Description,
                    ResourcePermissionType = m_permissionTypeUoW.FindPermissionTypeById(permissionTypeModel.ResourcePermissionType.Id)
                };

                var result = m_permissionTypeActionUoW.CreatePermissionTypeAction(permissionType);
                return(Success(result));
            }
            catch (NoResultException <ResourcePermissionTypeEntity> e)
            {
                m_logger.LogWarning(e);
                return(Error <int>(m_translator.Translate("invalid-permission-type-id"), DataResultErrorCode.PermissionTypeNotExistId));
            }
            catch (DatabaseException e)
            {
                m_logger.LogWarning(e);
                return(Error <int>(e.Message));
            }
        }
Exemple #2
0
        public virtual void UpdatePermissionTypeAction(int id, ResourcePermissionTypeActionEntity permissionType)
        {
            var permissionTypeActionEntity = m_permissionTypeActionRepository.FindPermissionTypeActionById(id);

            if (permissionTypeActionEntity == null)
            {
                throw new NoResultException <ResourcePermissionTypeActionEntity>();
            }

            permissionTypeActionEntity.Name        = permissionType.Name;
            permissionTypeActionEntity.Description = permissionType.Description;

            m_permissionTypeActionRepository.Update(permissionTypeActionEntity);
        }
Exemple #3
0
        public virtual int CreatePermissionTypeAction(ResourcePermissionTypeActionEntity permissionType)
        {
            var result = (int)m_permissionTypeActionRepository.Create(permissionType);

            return(result);
        }