示例#1
0
        public MessageResult RemoveObjectFormat(int id, bool pageOrTemplate)
        {
            var format = ObjectFormatRepository.ReadObjectFormat(id, pageOrTemplate);

            if (format == null)
            {
                throw new ApplicationException(string.Format(TemplateStrings.FormatNotFound, id));
            }

            if (format.LockedByAnyoneElse)
            {
                return(MessageResult.Error(string.Format(TemplateStrings.LockedByAnyoneElse, format.LockedByDisplayName)));
            }
            if (format.Notifications.Any())
            {
                return(MessageResult.Error(TemplateStrings.UnableToDeleteFormat));
            }

            ManagePageAndObjectModified(format);
            PageTemplateRepository.DeleteObjectFormat(id);
            return(null);
        }