예제 #1
0
        public async Task <IHttpActionResult> PostMasterAsync(string portalUri, string pageUri, [FromBody] string uri, CancellationToken cancellationToken)
        {
            var portal = await _portalManager.FindByUriAsync(portalUri, cancellationToken);

            await ApiSecurity.AuthorizeAsync(portal, AccessPermission.CanEdit, cancellationToken);

            var page = await _portalManager.GetPageByUriAsync(portal, pageUri, cancellationToken);

            if (page == null)
            {
                return(NotFound());
            }
            var validationResult = await _portalManager.SetPageMasterAsync(portal, page, uri, cancellationToken);

            if (!validationResult.Succeeded)
            {
                return(this.ValidationContent(validationResult));
            }
            return(Ok(ModelMapper.ToPageDto(page)));
        }