public async Task <IActionResult> Preview(PostFormViewModel model) { if (model == null) { return(new HttpStatusCodeResult((int)HttpStatusCode.BadRequest)); } var vm = new PostPreviewViewModel() { Theme = this._settings.Theme, HeadPartialViewPath = this._themeService.GetHeadPartialViewPath(this._settings.Theme), HeaderPartialViewPath = this._themeService.GetHeaderPartialViewPath(this._settings.Theme), PostPartialViewPath = this._themeService.GetPostPartialViewPath(this._settings.Theme), FooterPartialViewPath = this._themeService.GetFooterPartialViewPath(this._settings.Theme), }; var page = new PageSettings(); page.Title = "Hello World"; page.Description = "This is description"; page.Author = new Author() { Name = "joebloggs" }; page.Date = DateTime.Today; page.BaseUrl = this._settings.BaseUrl; page.Url = "/posts/post.html"; page.Pages = new List <PageSettings>(); vm.Page = page; var env = this.Resolver.GetService(typeof(IApplicationEnvironment)) as IApplicationEnvironment; var loader = new ThemeLoader(this._settings, new FileHelper(this._settings)); var site = await loader.LoadAsync(env).ConfigureAwait(false); vm.Site = site; var parsedHtml = this._markdownHelper.Parse(model.Body); vm.Html = parsedHtml; return(this.View(vm)); }