Esempio n. 1
0
        public CopyResult Copy(int id)
        {
            var result = new CopyResult();
            var page   = PageRepository.GetPagePropertiesById(id);

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

            page.MutatePage();
            ManagePageFolders(page, FolderManagingType.CreateFolder);
            var newId = PageRepository.CopyPage(page, QPContext.CurrentUserId);

            if (newId == 0)
            {
                result.Message = MessageResult.Error(TemplateStrings.PageNotCreated);
            }
            else
            {
                result.Id = newId;
            }
            return(result);
        }