예제 #1
0
        /// <summary>
        /// SaveContentPage
        /// </summary>
        /// <param name="contentPage"></param>
        public void SaveContentPage(ContentPageModel contentPage)
        {
            ContentPageDC         saveContentPageRequest  = Mapper.Map <ContentPageModel, ContentPageDC>(contentPage);
            ServiceResponse <int> saveContentPageResponse = _contentProxy.Execute(opt => opt.SaveContentPage(saveContentPageRequest));

            if (saveContentPageResponse.Status != ResponseStatus.Success)
            {
                HandleError(saveContentPageResponse.Status, saveContentPageResponse.ResponseMessage);
            }
            else
            {
                contentPage.ContentPageId = saveContentPageResponse.Result;
            }
        }
예제 #2
0
        /// <summary>
        /// SaveContentPage
        /// </summary>
        /// <param name="contentPage"></param>
        /// <returns></returns>
        public ServiceResponse <int> SaveContentPage(ContentPageDC contentPage)
        {
            ServiceResponse <int> contentPageResponse = new ServiceResponse <int>();

            try
            {
                SetContext();
                ContentPage contentPageModel = Mapper.Map <ContentPageDC, ContentPage>(contentPage);
                _contentManager.SaveContentPage(contentPageModel);
                contentPageResponse.Result = contentPageModel.ContentPageId;
                SecurityManager securityManager = null;
                // Create Navigation
                if (contentPage.AddToNavigation)
                {
                    securityManager = new SecurityManager();
                    int?navigationParentId = null;
                    if (!contentPage.NavigationParentId.Equals(0))
                    {
                        navigationParentId = contentPage.NavigationParentId;
                    }
                    securityManager.SaveNavigation(new Navigation
                    {
                        NavigationText     = contentPage.MenuTitle,
                        ContentPageId      = contentPageModel.ContentPageId,
                        CreatedById        = securityManager.UserContextDetails.UserId,
                        CreatedOn          = DateTime.UtcNow,
                        NavigationTypeId   = (int)NavigationTypeEnum.Content,
                        IsActive           = true,
                        SiteId             = securityManager.UserContextDetails.SiteId,
                        NavigationParentId = navigationParentId
                    });
                }
                // set as Home Page
                if (contentPage.SetToHomePage)
                {
                    if (securityManager == null)
                    {
                        securityManager = new SecurityManager();
                    }
                    SiteConfiguration siteConfiguration = securityManager.GetSiteConfiguration();
                    siteConfiguration.HomePageContentPageId = contentPageModel.ContentPageId;
                    securityManager.SaveSiteConfiguration(siteConfiguration);
                }
            }
            catch (Exception ex)
            {
                HandleError(ex, contentPageResponse);
            }
            return(contentPageResponse);
        }