Ejemplo n.º 1
0
        public HttpResponseMessage SavePageDetails(PageSettings pageSettings)
        {
            if (!_securityService.CanSavePageDetails(pageSettings))
            {
                return(GetForbiddenResponse());
            }

            try
            {
                pageSettings.Clean();
                var tab  = _pagesController.SavePageDetails(pageSettings);
                var tabs = TabController.GetPortalTabs(PortalSettings.PortalId, Null.NullInteger, false, true, false,
                                                       true);

                return(Request.CreateResponse(HttpStatusCode.OK, new
                {
                    Status = 0,
                    Page = Converters.ConvertToPageItem <PageItem>(tab, tabs)
                }));
            }
            catch (PageNotFoundException)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, new { Message = "Page doesn't exists." }));
            }
            catch (PageValidationException ex)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new { Status = 1, ex.Field, ex.Message }));
            }
        }