public async Task <IHttpActionResult> PutAsync(string portalUri, string pageUri, [FromBody] SetPageHeadDto model, CancellationToken cancellationToken) { if (model == null || !ModelState.IsValid) { return(BadRequest()); } var portal = await _portalManager.FindByUriAsync(portalUri, cancellationToken); await ApiSecurity.AuthorizeAsync(portal, AccessPermission.CanEdit, cancellationToken); var page = await _portalManager.GetPageByUriAsync(portal, pageUri, PageField.All, cancellationToken); if (page == null) { return(NotFound()); } ValidationResult validationResult; if (model.Uri != null) { validationResult = await _portalManager.SetPageUriAsync(portal, page, model.Uri, cancellationToken); if (!validationResult.Succeeded) { return(this.ValidationContent(validationResult)); } } page.Name = model.Name; page.Description = model.Description; validationResult = await _portalManager.ReplacePageAsync(portal, page, page, cancellationToken); if (!validationResult.Succeeded) { return(this.ValidationContent(validationResult)); } return(Ok(ModelMapper.ToPageDto(page))); }