public PutBlogPostPropertiesResponse Put(PutBlogPostPropertiesRequest request)
        {
            var serviceModel = request.Data.ToServiceModel();

            if (request.Id.HasValue)
            {
                serviceModel.Id = request.Id.Value;
            }

            string[] error;
            var      childContentOptionValues = request.Data.ChildContentsOptionValues != null?request.Data.ChildContentsOptionValues.ToViewModel() : null;

            var response = blogSaveService.SaveBlogPost(serviceModel, childContentOptionValues, securityService.GetCurrentPrincipal(), out error);

            if (response == null)
            {
                throw new CmsApiValidationException(error != null && error.Length > 0 ? string.Join(",", error) : "Page properties saving was canceled.");
            }

            return(new PutBlogPostPropertiesResponse {
                Data = response.Id
            });
        }
Ejemplo n.º 2
0
        public PutBlogPostPropertiesResponse Put(PutBlogPostPropertiesRequest request)
        {
            var serviceModel = request.Data.ToServiceModel();
            if (request.Id.HasValue)
            {
                serviceModel.Id = request.Id.Value;
            }

            string[] error;
            var response = blogSaveService.SaveBlogPost(serviceModel, securityService.GetCurrentPrincipal(), out error);
            if (response == null)
            {
                throw new CmsApiValidationException(error != null && error.Length > 0 ? string.Join(",", error) : "Page properties saving was canceled.");
            }

            return new PutBlogPostPropertiesResponse { Data = response.Id };
        }