Fixing new content type validation

Work Item: 16471

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-11-23 12:43:09 -08:00
parent 35c2a6b6ac
commit 3c2b6c6111

View File

@@ -52,13 +52,13 @@ namespace Orchard.ContentTypes.Controllers {
ModelState.AddModelError("DisplayName", T("A type with the same name already exists.").ToString());
}
var typeViewModel = _contentDefinitionService.AddType(viewModel);
if (!ModelState.IsValid) {
Services.TransactionManager.Cancel();
return View(viewModel);
}
var typeViewModel = _contentDefinitionService.AddType(viewModel);
Services.Notifier.Information(T("The \"{0}\" content type has been created.", typeViewModel.DisplayName));
return RedirectToAction("Edit", new { id = typeViewModel.Name });