Ejemplo n.º 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)
         * {
         *  const string commandText = @"DELETE FROM PEC2WEBUSERLOGINS WHERE USERID = :USERID AND LOGINPROVIDER = :LOGINPROVIDER AND PROVIDERKEY = :PROVIDERKEY";
         *  var parameters = new List<OracleParameter>
         *  {
         *      new OracleParameter{ ParameterName = "USERID", Value = user.Id, OracleDbType = OracleDbType.Varchar2 },
         *      new OracleParameter{ ParameterName = "LOGINPROVIDER", Value = login.LoginProvider, OracleDbType = OracleDbType.Varchar2 },
         *      new OracleParameter{ ParameterName = "PROVIDERKEY", Value = login.ProviderKey, OracleDbType = OracleDbType.Varchar2 },
         *  };
         *
         *  return _database.Execute(commandText, parameters);
         * }*/

        /// <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)
        {
            const string commandText = @"DELETE FROM PEC2WEBUSERLOGINS WHERE USERID = :USERID";
            var          parameters  = new List <OracleParameter>
            {
                new OracleParameter {
                    ParameterName = "USERID", Value = userId, OracleDbType = OracleDbType.Varchar2
                },
            };

            return(_database.Execute(commandText, parameters));
        }