Example #1
0
        //tag a product to tagName
        public Guid Tag(string tagName, Guid userId, string comment)
        {
            bn_HashTag bnHashTag = new bn_HashTag();
            var        hashTag   = bnHashTag.GetByTagName(tagName);
            Guid       re        = Guid.Empty;

            if (hashTag != null)
            {
                //exists tagName
                re = Create(
                    hashTag.HashTagId,
                    userId,
                    comment);
            }
            else
            {
                //not exists
                var hashTagId = bnHashTag.Create(
                    userId,
                    EHashtag_Type.Public,
                    null,
                    tagName,
                    null, null, null);

                if (hashTagId != Guid.Empty)
                {
                    re = Create(
                        hashTagId,
                        userId,
                        comment);
                }
            }

            return(re);
        }
Example #2
0
        public static List <string> DivTags(string tags)
        {
            List <string> temp;
            List <string> tagList = new List <string>();

            temp = tags.Split(new[] { '#', ' ', ',', '@' }).ToList();

            foreach (var item in temp)
            {
                if (item != "")
                {
                    tagList.Add(item.Replace(" ", ""));
                }
            }

            bn_HashTag bnHashTag = new bn_HashTag();

            bnHashTag.Create(tagList);

            return(tagList);
        }