示例#1
0
 public Xinchen.PrivilegeManagement.DTO.Role AddRole(AddRoleModel addRoleModel)
 {
     if (this._privilegeBase.GetRole(addRoleModel.Name) != null)
     {
         throw new ApplicationException("该名称已存在");
     }
     return this._privilegeBase.AddRole(addRoleModel.Name, addRoleModel.Status, null);
 }
示例#2
0
 public Xinchen.PrivilegeManagement.DTO.Role AddRole(AddRoleModel addRoleModel, int[] privileges)
 {
     using (TransactionScope scope = new TransactionScope())
     {
         Xinchen.PrivilegeManagement.DTO.Role role = this._privilegeBase.GetRole(addRoleModel.Name);
         if (role != null)
         {
             throw new ApplicationException("该名称已存在");
         }
         role = this._privilegeBase.AddRole(addRoleModel.Name, addRoleModel.Status, addRoleModel.Description, null);
         foreach (int num in privileges)
         {
             this._privilegeBase.AddRolePrivilege(role.Id, num);
         }
         scope.Complete();
         return role;
     }
 }