public IActionResult NewsPostEditForm(string id, [FromQuery] string version = null) { var user = _userContextAccessor.GetContext(); var newsPost = _newsManager.GetNewsPost(id, version); // Ensure the user can edit the post if (!_newsSecurity.AuthorizeForEdit(newsPost)) { return(Unauthorized()); } // If the version specified is not already a draft, then create a new draft version if (newsPost.Status != Connect.Models.ContentStatus.Draft) { newsPost = _newsManager.CloneNewsPostAsDraft(newsPost, user.UserId); } // Create the view model var newsPostViewModel = newsPost.ProjectTo <NewsPostViewModel>(); var versionInfo = _contentManager.GetVersionInfo(NewsManager.CONTENT_TYPE_NEWSPOST, newsPost.Id, newsPost.VersionCode).Result; newsPostViewModel.VersionLabel = versionInfo.VersionLabel; newsPostViewModel.PostPrivacyConfig = BuildPostPrivacyOptions(newsPost); newsPostViewModel.Categories = newsPost.Categories.Select(x => x.Category); return(this.PartialContentView(new ContentBindings(versionInfo) { ViewPath = "/UI/Views/Console/News/newsPostDesign.cshtml", ViewModel = newsPostViewModel, Editable = true })); }