Beispiel #1
0
 public void Insert(IdentityMember member, int roleId)
 {
     this.db.Connection.Execute("Insert into AspNetUserRoles (UserId, RoleId) values (@userId, @roleId)", (object)new
     {
         userId = member.Id,
         roleId = roleId
     }, (IDbTransaction)null, new int?(), new CommandType?());
 }
Beispiel #2
0
 public void Delete(IdentityMember member, UserLoginInfo login)
 {
     this.db.Connection.Execute("Delete from AspNetUserLogins \r\n                    where UserId = @userId \r\n                    and LoginProvider = @loginProvider \r\n                    and ProviderKey = @providerKey", (object)new
     {
         userId        = member.Id,
         loginProvider = login.LoginProvider,
         providerKey   = login.ProviderKey
     }, (IDbTransaction)null, new int?(), new CommandType?());
 }
Beispiel #3
0
 public void Insert(IdentityMember member, UserLoginInfo login)
 {
     this.db.Connection.Execute("Insert into AspNetUserLogins \r\n                (LoginProvider, ProviderKey, UserId) \r\n                values (@loginProvider, @providerKey, @userId)", (object)new
     {
         loginProvider = login.LoginProvider,
         providerKey   = login.ProviderKey,
         userId        = member.Id
     }, (IDbTransaction)null, new int?(), new CommandType?());
 }
Beispiel #4
0
 public void Delete(IdentityMember member, Claim claim)
 {
     this.db.Connection.Execute("Delete from AspNetUserClaims \r\n            where UserId = @memberId and @ClaimValue = @value and ClaimType = @type", (object)new
     {
         memberId   = member.Id,
         ClaimValue = claim.Value,
         type       = claim.Type
     }, (IDbTransaction)null, new int?(), new CommandType?());
 }
Beispiel #5
0
 /// <summary>
 /// Deletes a claim from a user
 /// </summary>
 /// <param name="user">The user to have a claim deleted</param>
 /// <param name="claim">A claim to be deleted from user</param>
 /// <returns></returns>
 public void Delete(IdentityMember member, Claim claim)
 {
     db.Connection.Execute(@"Delete from MemberClaim 
     where UserId = @memberId and @ClaimValue = @value and ClaimType = @type",
                           new {
         memberId   = member.Id,
         ClaimValue = claim.Value,
         type       = claim.Type
     });
 }
Beispiel #6
0
 /// <summary>
 /// Inserts a new login in the UserLogins table
 /// </summary>
 /// <param name="user">User to have new login added</param>
 /// <param name="login">Login to be added</param>
 /// <returns></returns>
 public void Insert(IdentityMember member, UserLoginInfo login)
 {
     db.Connection.Execute(@"Insert into MemberLogin 
         (LoginProvider, ProviderKey, UserId) 
         values (@loginProvider, @providerKey, @userId)",
                           new
     {
         loginProvider = login.LoginProvider,
         providerKey   = login.ProviderKey,
         userId        = member.Id
     });
 }
Beispiel #7
0
 /// <summary>
 /// Deletes a login from a user in the UserLogins table
 /// </summary>
 /// <param name="user">User to have login deleted</param>
 /// <param name="login">Login to be deleted from user</param>
 /// <returns></returns>
 public void Delete(IdentityMember member, UserLoginInfo login)
 {
     db.Connection.Execute(@"Delete from MemberLogin 
             where UserId = @userId 
             and LoginProvider = @loginProvider 
             and ProviderKey = @providerKey",
                           new
     {
         userId        = member.Id,
         loginProvider = login.LoginProvider,
         providerKey   = login.ProviderKey
     });
 }
 /// <summary>
 /// Inserts a new login in the UserLogins table
 /// </summary>
 /// <param name="user">User to have new login added</param>
 /// <param name="login">Login to be added</param>
 /// <returns></returns>
 public void Insert(IdentityMember member, UserLoginInfo login)
 {
     using (var connection = DbConnectionFactory.GetOpenConnection())
     {
         connection.Execute(@"Insert into MemberLogin 
         (LoginProvider, ProviderKey, UserId) 
         values (@loginProvider, @providerKey, @userId)",
                            new
         {
             loginProvider = login.LoginProvider,
             providerKey   = login.ProviderKey,
             userId        = member.Id
         });
     }
 }
 /// <summary>
 /// Deletes a claim from a user
 /// </summary>
 /// <param name="user">The user to have a claim deleted</param>
 /// <param name="claim">A claim to be deleted from user</param>
 /// <returns></returns>
 public void Delete(IdentityMember member, Claim claim)
 {
     using (var connection = DbConnectionFactory.GetOpenConnection())
     {
         connection.Execute(@"
             Delete from MemberClaim where UserId = @memberId and @ClaimValue = @value and ClaimType = @type",
                            new
         {
             memberId   = member.Id,
             ClaimValue = claim.Value,
             type       = claim.Type
         }
                            );
     }
 }
 /// <summary>
 /// Deletes a login from a user in the UserLogins table
 /// </summary>
 /// <param name="user">User to have login deleted</param>
 /// <param name="login">Login to be deleted from user</param>
 /// <returns></returns>
 public void Delete(IdentityMember member, UserLoginInfo login)
 {
     using (var connection = DbConnectionFactory.GetOpenConnection())
     {
         connection.Execute(@"
             Delete from MemberLogin 
             where UserId = @userId 
             and LoginProvider = @loginProvider 
             and ProviderKey = @providerKey",
                            new
         {
             userId        = member.Id,
             loginProvider = login.LoginProvider,
             providerKey   = login.ProviderKey
         });
     }
 }
Beispiel #11
0
 public async Task Insert(IdentityMember user, int roleId)
 {
     using (var connection = await DbConnectionFactory.GetOpenConnectionAsync())
     {
         await connection.ExecuteAsync($@"
             INSERT INTO {TableConstants.UserRoleTable}
             (
                 UserId,
                 RoleId
             )
             VALUES
             (
                 @UserId,
                 @RoleId
             );",
                                       new
         {
             UserId = user.Id,
             RoleId = roleId
         }
                                       );
     }
 }
Beispiel #12
0
 /// <summary>
 /// Inserts a new role for a user in the UserRoles table
 /// </summary>
 /// <param name="user">The User</param>
 /// <param name="roleId">The Role's id</param>
 /// <returns></returns>
 public void Insert(IdentityMember member, int roleId)
 {
     db.Connection.Execute(@"Insert into AspNetUserRoles (UserId, RoleId) values (@userId, @roleId",
                           new { userId = member.Id, roleId = roleId });
 }
Beispiel #13
0
 /// <summary>
 /// Inserts a new role for a user in the UserRoles table
 /// </summary>
 /// <param name="user">The User</param>
 /// <param name="roleId">The Role's id</param>
 /// <returns></returns>
 public void Insert(IdentityMember member, int roleId)
 {
     db.Connection.Execute(@"Insert into MemberRole (MemberId, RoleId) values (@MemberId, @RoleId)",
                           new { MemberId = member.Id, RoleId = roleId });
 }