Minor alteration to previous contribution

This commit is contained in:
Suha Can
2011-02-03 11:01:45 -08:00
parent 86c11ada8e
commit b14d95778b
2 changed files with 4 additions and 7 deletions

View File

@@ -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");
} }

View File

@@ -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;
} }