/// <summary> /// Deletes all Logins from a user in the UserLogins table /// </summary> /// <param name="userId">The user's id</param> /// <returns></returns> public int Delete(string userId) { ConnectionService.ThreadVanityUrl = ConnectionName; AspNetUserLoginsQuery q = new AspNetUserLoginsQuery(); q.Where(q.UserId == userId); AspNetUserLoginsCollection loginUsers = new AspNetUserLoginsCollection(); SetConnection(loginUsers); if (loginUsers.Load(q)) { loginUsers.MarkAllAsDeleted(); loginUsers.Save(); } return(1); }
/// <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 int Delete(IdentityUser user, UserLoginInfo login) { ConnectionService.ThreadVanityUrl = ConnectionName; AspNetUserLoginsQuery q = new AspNetUserLoginsQuery(); q.Where(q.UserId == user.Id && q.LoginProvider == login.LoginProvider && q.ProviderKey == login.ProviderKey); AspNetUserLoginsCollection loginUsers = new AspNetUserLoginsCollection(); SetConnection(loginUsers); if (loginUsers.Load(q)) { loginUsers.MarkAllAsDeleted(); loginUsers.Save(); } return(1); }