#17684 Fixing issue where a user trys to create two parts of the same name

Work Item: 17684
This commit is contained in:
Nicholas Mayne 2014-05-11 14:05:20 +01:00
parent 68e9972579
commit 0b657fa8f9

View File

@ -387,6 +387,9 @@ namespace Orchard.ContentTypes.Controllers {
if (!Services.Authorizer.Authorize(Permissions.EditContentTypes, T("Not allowed to create a content part.")))
return new HttpUnauthorizedResult();
if (_contentDefinitionManager.GetPartDefinition(viewModel.Name) != null)
ModelState.AddModelError("Name", T("Cannot add part named '{0}'. It already exists.", viewModel.Name).ToString());
if (!ModelState.IsValid)
return View(viewModel);