예제 #1
0
        /// <summary> Delete a user tag from this object, by TagID and UserID </summary>
        /// <param name="TagID"> Primary key for this tag from the database </param>
        /// <param name="UserID">  Primary key for the user who entered this tag </param>
        /// <returns> Returns TRUE is successful, otherwise FALSE </returns>
        /// <remarks> This only deletes the user tag if the UserID for the tag matches the provided userid </remarks>
        public bool Delete_User_Tag(int TagID, int UserID)
        {
            if (tags == null)
            {
                return(false);
            }

            Descriptive_Tag tag_to_delete = null;

            foreach (Descriptive_Tag thisTag in tags)
            {
                if ((thisTag.TagID == TagID) && (thisTag.UserID == UserID))
                {
                    tag_to_delete = thisTag;
                    break;
                }
            }
            if (tag_to_delete != null)
            {
                tags.Remove(tag_to_delete);
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        /// <summary> Delete a user tag from this object, by TagID and UserID </summary>
        /// <param name="TagID"> Primary key for this tag from the database </param>
        /// <param name="UserID">  Primary key for the user who entered this tag </param>
        /// <returns> Returns TRUE is successful, otherwise FALSE </returns>
        /// <remarks> This only deletes the user tag if the UserID for the tag matches the provided userid </remarks>
        public bool Delete_User_Tag(int TagID, int UserID)
        {
            if (tags == null)
            {
                return(false);
            }

            Descriptive_Tag tag_to_delete = tags.FirstOrDefault(ThisTag => (ThisTag.TagID == TagID) && (ThisTag.UserID == UserID));

            if (tag_to_delete == null)
            {
                return(false);
            }

            tags.Remove(tag_to_delete);
            return(true);
        }