Exemple #1
0
        private void UpdateHomeDocumentType()
        {
            const string
                propertyName    = "Tenant Preferences",
                dataTypeName    = "Total Code Tenant Properties",
                oldDataTypeName = "Total Tode Tenant Properties";

            try
            {
                var existingDataType = dataTypeService.GetDataType(oldDataTypeName);
                if (existingDataType != null)
                {
                    existingDataType.Name = dataTypeName;
                    dataTypeService.Save(existingDataType);

                    var container   = dataTypeService.GetContainers(CONTAINER, 1).FirstOrDefault();
                    var containerId = -1;

                    if (container != null)
                    {
                        containerId = container.Id;
                    }

                    dataTypeService.Move(existingDataType, containerId);
                    ConnectorContext.AuditService.Add(AuditType.Move, -1, existingDataType.Id, "Data Type", $"Data Type '{propertyName}' has been updated and moved");
                }
            }
            catch (System.Exception ex)
            {
                logger.Error(typeof(_16_MoveTenantPreferencesPropertyType), ex.Message);
                logger.Error(typeof(_16_MoveTenantPreferencesPropertyType), ex.StackTrace);
            }
        }
Exemple #2
0
        /// <summary>
        /// Move the media type
        /// </summary>
        /// <param name="move"></param>
        /// <returns></returns>
        public IActionResult PostMove(MoveOrCopy move)
        {
            var toMove = _dataTypeService.GetDataType(move.Id);

            if (toMove == null)
            {
                return(NotFound());
            }

            var result = _dataTypeService.Move(toMove, move.ParentId);

            if (result.Success)
            {
                return(Content(toMove.Path, MediaTypeNames.Text.Plain, Encoding.UTF8));
            }

            switch (result.Result.Result)
            {
            case MoveOperationStatusType.FailedParentNotFound:
                return(NotFound());

            case MoveOperationStatusType.FailedCancelledByEvent:
                return(ValidationProblem());

            case MoveOperationStatusType.FailedNotAllowedByPath:
                var notificationModel = new SimpleNotificationModel();
                notificationModel.AddErrorNotification(_localizedTextService.Localize("moveOrCopy", "notAllowedByPath"), "");
                return(ValidationProblem(notificationModel));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }