public IActionResult SelectCondition([FromBody] UserRoleTable role)
 {
     try
     {
         var table = _repository.LoadAll();
         if (role.RoleTableId.HasValue)
         {
             table = table.Where(t => t.RoleTableId == role.RoleTableId);
         }
         return(Json(new
         {
             table = table.ToList(),
             state = "0",
             msg = "操作成功!"
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             state = "-1",
             msg = "非法操作!"
         }));
     }
 }
        public static void ClassInitialize(TestContext context)
        {
            _database      = new Database(IdentityConstants.ConnecionName);
            _roleTable     = new RoleTable(_database);
            _userTable     = new UserTable <IdentityUser>(_database);
            _userRoleTable = new UserRoleTable(_database);

            _userTable.Insert(new IdentityUser()
            {
                UserName = name1, Email = email1
            });
            _userTable.Insert(new IdentityUser()
            {
                UserName = name2, Email = email2
            });

            _roleTable.Insert(new IdentityRole()
            {
                Name = role1
            });
            _roleTable.Insert(new IdentityRole()
            {
                Name = role2
            });
        }
 public void Initialize()
 {
     database      = new DbManager("DefaultConnection");
     userRoleTable = database.GetUserRoleTable();
     userTable     = database.GetUserTable <IdentityUser>();
     roleTable     = database.GetRoleTable();
 }
 public UserStore(Database nPocoDb)
 {
     NPocoDb         = nPocoDb;
     _userTable      = new UserTable <TUser>(nPocoDb);
     _roleTable      = new RoleTable(nPocoDb);
     _claimTable     = new ClaimTable(nPocoDb);
     _clientTable    = new ClientTable(nPocoDb);
     _userRoleTable  = new UserRoleTable(nPocoDb);
     _userClaimTable = new UserClaimTable(nPocoDb);
     _userLoginTable = new UserLoginTable(nPocoDb);
 }
        public void Dispose()
        {
            if (NPocoDb != null)
            {
                NPocoDb.Dispose();
                NPocoDb = null;
            }

            _userTable      = null;
            _roleTable      = null;
            _claimTable     = null;
            _clientTable    = null;
            _userRoleTable  = null;
            _userClaimTable = null;
            _userLoginTable = null;
        }
 public IActionResult Add([FromBody] UserRoleTable role)
 {
     try
     {
         int id = _repository.SaveGetId(role);
         return(Json(new
         {
             id,
             state = "0",
             msg = "添加成功!"
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             state = "-1",
             msg = "非法操作!"
         }));
     }
 }
        public static void ClassInitialize(TestContext context)
        {
            _database      = new Database(IdentityConstants.ConnectionName);
            _roleTable     = new RoleTable(_database);
            _userTable     = new UserTable <IdentityUser>(_database);
            _clientTable   = new ClientTable(_database);
            _userRoleTable = new UserRoleTable(_database);

            _clientTable.Insert(new IdentityClient(client));
            var TestClientId = _clientTable.GetClientByName(client).Id;

            _userTable.Insert(new IdentityUser(TestClientId, name1)
            {
                Email = email1
            });
            _userTable.Insert(new IdentityUser(TestClientId, name2)
            {
                Email = email2
            });

            _roleTable.Insert(new IdentityRole(role1));
            _roleTable.Insert(new IdentityRole(role2));
        }