コード例 #1
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 int Delete(IdentityUser user, UserLoginInfo login)
        {
            var userlogin = loginFile.Logins.FirstOrDefault(x => x.UserId == user.Id && x.LoginProvider == login.LoginProvider && x.ProviderKey == login.ProviderKey);

            loginFile.Logins.Remove(userlogin);
            loginFile = FileDatabase.UpdateLoginDb(loginFile);
            return(1);
        }
コード例 #2
0
        /// <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)
        {
            var userlogin = loginFile.Logins.FirstOrDefault(x => x.UserId == userId);

            loginFile.Logins.Remove(userlogin);
            loginFile = FileDatabase.UpdateLoginDb(loginFile);
            return(1);
        }
コード例 #3
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 int Insert(IdentityUser user, UserLoginInfo login)
        {
            var newlogin = new HsUserLogin();

            newlogin.LoginProvider = login.LoginProvider;
            newlogin.ProviderKey   = login.ProviderKey;
            newlogin.UserId        = user.Id;

            loginFile.Logins.Add(newlogin);
            loginFile = FileDatabase.UpdateLoginDb(loginFile);
            return(1);
        }
コード例 #4
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance
 /// </summary>
 /// <param name="database"></param>
 public UserLoginsTable()
 {
     loginFile = FileDatabase.GetUserLoginDb();
 }