Fixed a bug in content creation where all of the handlers were being called twice

- had two UpdateEditorModel calls in the create action

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-07-15 22:44:28 -07:00
parent 94a7311c4b
commit b11fe1033c

View File

@@ -114,17 +114,14 @@ namespace Orchard.Core.Contents.Controllers {
var contentItem = _contentManager.New(model.Id); var contentItem = _contentManager.New(model.Id);
model.Content = _contentManager.UpdateEditorModel(contentItem, this); model.Content = _contentManager.UpdateEditorModel(contentItem, this);
if (ModelState.IsValid) {
_contentManager.Create(contentItem, VersionOptions.Draft);
model.Content = _contentManager.UpdateEditorModel(contentItem, this);
}
if (!ModelState.IsValid) { if (!ModelState.IsValid) {
_transactionManager.Cancel(); _transactionManager.Cancel();
PrepareEditorViewModel(model.Content); PrepareEditorViewModel(model.Content);
return View("Create", model); return View("Create", model);
} }
_contentManager.Create(contentItem, VersionOptions.Draft);
//need to go about this differently - to know when to publish (IPlublishableAspect ?) //need to go about this differently - to know when to publish (IPlublishableAspect ?)
if (!contentItem.Has<IPublishingControlAspect>()) if (!contentItem.Has<IPublishingControlAspect>())
_contentManager.Publish(contentItem); _contentManager.Publish(contentItem);