Exemple #1
0
        public static string Generate_Auto_Tag_Links(ApplicationDbContext context, string text)
        {
            var _lst = TagsBLL.LoadItems(context, new TagEntity()
            {
                type = TagsBLL.Types.Blogs
            }).Result;

            if (_lst.Count == 0)
            {
                return(text);
            }
            if (_lst.Count > 0)
            {
                int    i        = 0;
                string keywords = "";
                for (i = 0; i <= _lst.Count - 1; i++)
                {
                    if (_lst[i].title.Length > 3)
                    {
                        keywords = @"(?<hrefurl><a[^>]*>.*?</a>)|(?<term>(\b" + _lst[i].title.Trim().ToLower() + @"\b))";
                        text     = Regex.Replace(text, keywords, new MatchEvaluator(AutoTagLink));
                    }
                }
            }
            return(text);
        }
        public async Task <ActionResult> getinfo()
        {
            var json   = new StreamReader(Request.Body).ReadToEnd();
            var data   = JsonConvert.DeserializeObject <List <TagEntity> >(json);
            var _posts = await TagsBLL.LoadItems(_context, data[0]);

            return(Ok(new { post = _posts[0] }));
        }
        public async Task <ActionResult> load()
        {
            var json   = new StreamReader(Request.Body).ReadToEnd();
            var data   = JsonConvert.DeserializeObject <TagEntity>(json);
            var _posts = await TagsBLL.LoadItems(_context, data);

            var _records = 0;

            if (data.id == 0)
            {
                _records = await TagsBLL.Count(_context, data);
            }
            return(Ok(new { posts = _posts, records = _records }));
        }