Exemplo n.º 1
0
        public void CreateRole(string roleName)
        {
            if (RoleExists(roleName))
                throw new InvalidOperationException("Role with specified name already exists.");

            var role = new Role {RoleName = roleName};
            UnitOfWork.GetRepository<Role>().Insert(role);
            UnitOfWork.Save();
        }
Exemplo n.º 2
0
 private void BindUserToRole(User user, Role role)
 {
     user.Roles.Add(role);
     role.Users.Add(user);
 }
Exemplo n.º 3
0
 private void AddRole(Role role)
 {
     _unitOfWork.GetRepository<Role>().Insert(role);
     _unitOfWork.Save();
 }