mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
#17684 Fixing issue where a user trys to create two parts of the same name
Work Item: 17684
This commit is contained in:
parent
68e9972579
commit
0b657fa8f9
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user