diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs b/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs index ace820b8c..98e5459ad 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs +++ b/src/Orchard.Web/Modules/Orchard.Comments/Controllers/CommentController.cs @@ -32,9 +32,10 @@ namespace Orchard.Comments.Controllers { var comment = Services.ContentManager.New("Comment"); - Services.ContentManager.Create(comment); var editorShape = Services.ContentManager.UpdateEditor(comment, this); + Services.ContentManager.Create(comment); + if (ModelState.IsValid) { if (comment.Has()) { var commentPart = comment.As(); diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Tokens/CommentTokens.cs b/src/Orchard.Web/Modules/Orchard.Comments/Tokens/CommentTokens.cs index 94b9dff2b..39176a1a1 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Tokens/CommentTokens.cs +++ b/src/Orchard.Web/Modules/Orchard.Comments/Tokens/CommentTokens.cs @@ -30,16 +30,16 @@ namespace Orchard.Comments.Tokens { public void Evaluate(dynamic context) { context.For("Content") - .Token("CommentedOn", (Func)(content => content.As().Record.CommentedOn)) - .Chain("CommentedOn", "Content", (Func)(content => _contentManager.Get(content.As().Record.CommentedOn))) - .Token("CommentMessage", (Func)(content => content.As().Record.CommentText)) + .Token("CommentedOn", (Func)(content => content.As().CommentedOn)) + .Chain("CommentedOn", "Content", (Func)(content => _contentManager.Get(content.As().CommentedOn))) + .Token("CommentMessage", (Func)(content => content.As().CommentText)) .Token("CommentAuthor", (Func)CommentAuthor) ; } private static string CommentAuthor(IContent comment) { var commentPart = comment.As(); - return String.IsNullOrWhiteSpace(commentPart.Record.UserName) ? commentPart.Record.Author : commentPart.Record.UserName; + return String.IsNullOrWhiteSpace(commentPart.UserName) ? commentPart.Author : commentPart.UserName; } } } \ No newline at end of file