mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-22 03:37:25 +08:00
Minor alteration to previous contribution
This commit is contained in:
@@ -79,10 +79,8 @@ namespace Orchard.Roles.Controllers {
|
|||||||
UpdateModel(viewModel);
|
UpdateModel(viewModel);
|
||||||
|
|
||||||
//check if the role name already exists
|
//check if the role name already exists
|
||||||
if (!_roleService.VerifyRoleUnicity(viewModel.Name))
|
if (!_roleService.VerifyRoleUnicity(viewModel.Name)) {
|
||||||
{
|
Services.Notifier.Error(T("Creating Role {0} failed: Role with same name already exists", viewModel.Name));
|
||||||
Services.Notifier.Error(T("Creating Role failed: {0}", "Role with same name already exists"));
|
|
||||||
|
|
||||||
return RedirectToAction("Create");
|
return RedirectToAction("Create");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -156,9 +156,8 @@ namespace Orchard.Roles.Services {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">Role name</param>
|
/// <param name="name">Role name</param>
|
||||||
/// <returns>Returns false if a role with the given name already exits</returns>
|
/// <returns>Returns false if a role with the given name already exits</returns>
|
||||||
public bool VerifyRoleUnicity(string name)
|
public bool VerifyRoleUnicity(string name) {
|
||||||
{
|
return (_roleRepository.Get(x => x.Name == name) == null);
|
||||||
return _roleRepository.Get(x => x.Name == name) == null ? true : false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user