Ejemplo n.º 1
0
        /// <summary>
        /// Inserts a new Role in the Roles table
        /// </summary>
        /// <param name="role">The role.</param>
        /// <returns></returns>
        public int Insert(IdentityRole role)
        {
            const string commandText = "[Security].[RoleInsert]";
            var parameters = new Dictionary<string, object>
            {
                {"@name", role.Name},
                {"@id", role.Id}
            };

            return _connection.Execute(commandText, parameters, null, null, CommandType.StoredProcedure);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the IdentityRole given the role Id
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public IdentityRole GetRoleById(string roleId)
        {
            var roleName = GetRoleName(roleId);
            IdentityRole role = null;

            if (roleName != null)
            {
                role = new IdentityRole(roleName, roleId);
            }

            return role;
        }