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(); }
private void BindUserToRole(User user, Role role) { user.Roles.Add(role); role.Users.Add(user); }
private void AddRole(Role role) { _unitOfWork.GetRepository<Role>().Insert(role); _unitOfWork.Save(); }