Changing the Blog Create action to not try to add the blog slug to the blog slug constraint until after model state validation is verified.

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-07-29 09:31:35 -07:00
parent b70858cf5c
commit 7e6cbf091f

View File

@@ -67,13 +67,14 @@ namespace Orchard.Blogs.Controllers {
_blogService.Create(blog);
model.Blog = _contentManager.UpdateEditorModel(blog, this);
_blogSlugConstraint.AddSlug(model.Blog.Item.Slug);
if (!ModelState.IsValid) {
_transactionManager.Cancel();
return View(model);
}
_blogSlugConstraint.AddSlug(model.Blog.Item.Slug);
return Redirect(Url.BlogForAdmin(model.Blog.Item.Slug));
}