Exemple #1
0
        public HttpResponseMessage SetPagePriority(int portalId, int tabId, string priority)
        {
            try
            {
                if (SecurityService.IsPagesAdminUser() == false)
                {
                    return(this.GetForbiddenResponse());
                }

                PagesControllerImpl pageController = new PagesControllerImpl();

                float pagePriority;
                if (float.TryParse(priority, out pagePriority) == false)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, new HttpError(Constants.ERROR_PAGE_PRIORITY_INVALID)
                    {
                        { Constants.RESPONSE_SUCCESS, false }
                    }));
                }

                var response = pageController.UpdatePageProperty(portalId, tabId, TabFields.Priority, priority);
                return(Request.CreateResponse <dynamic>(HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                LogError(ex);
                Exceptions.LogException(ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, new HttpError(ex.Message)
                {
                    { Constants.RESPONSE_SUCCESS, false }
                }));
            }
        }
Exemple #2
0
        public HttpResponseMessage SetPageName(int portalId, int tabId, string name)
        {
            try
            {
                if (SecurityService.IsPagesAdminUser() == false)
                {
                    return(this.GetForbiddenResponse());
                }
                PagesControllerImpl pageController = new PagesControllerImpl();

                if (string.IsNullOrEmpty(name))
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, new HttpError(Constants.ERROR_PAGE_NAME_REQUIRED)
                    {
                        { Constants.RESPONSE_SUCCESS, false }
                    }));
                }

                var response = pageController.UpdatePageProperty(portalId, tabId, TabFields.Name, name);
                return(Request.CreateResponse <dynamic>(HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                LogError(ex);
                Exceptions.LogException(ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, new HttpError(ex.Message)
                {
                    { Constants.RESPONSE_SUCCESS, false }
                }));
            }
        }
Exemple #3
0
        public HttpResponseMessage SetPageKeywords(int portalId, int tabId, string keywords)
        {
            try
            {
                if (SecurityService.IsPagesAdminUser() == false)
                {
                    return(this.GetForbiddenResponse());
                }
                PagesControllerImpl pageController = new PagesControllerImpl();

                var response = pageController.UpdatePageProperty(portalId, tabId, TabFields.Keywords, keywords);
                return(Request.CreateResponse <dynamic>(HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                LogError(ex);
                Exceptions.LogException(ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, new HttpError(ex.Message)
                {
                    { Constants.RESPONSE_SUCCESS, false }
                }));
            }
        }