예제 #1
0
        public override void CreateRole(string rolename)
        {
            var role = RoleGuardClauses(rolename, false);
            if (role != null) throw new ProviderException("Role already exists.");

            var newRole = new Role();
            newRole.ApplicationName = ApplicationName;
            newRole.RoleName = rolename;
            _memberRepo.SaveRole(newRole);
        }
 public void SaveRole(Role roleToSave)
 {
     using (var session = SessionFactory.OpenSession())
     {
         using (var trans = session.BeginTransaction())
         {
             session.SaveOrUpdate(roleToSave);
             trans.Commit();
         }
     }
 }
 public void DeleteRole(Role roleToDelete)
 {
     using (var session = SessionFactory.OpenSession())
     {
         using (var trans = session.BeginTransaction())
         {
             session.Delete(roleToDelete);
             trans.Commit();
         }
     }
 }