public ActionResult proc()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <JGN_Tags>(json);

            if (data.title.Length < 3)
            {
                return(Ok(new { status = "error", message = SiteConfig.generalLocalizer["_invalid_title"].Value }));
            }

            if (UtilityBLL.isLongWordExist(data.title) || UtilityBLL.isLongWordExist(data.title))
            {
                return(Ok(new { status = "error", message = SiteConfig.generalLocalizer["_invalid_title"].Value }));
            }

            dynamic CategoryContentType = 1;

            if (data.id > 0)
            {
                // Update Operation
                TagsBLL.Update(_context, data);
            }
            else
            {
                // Add Operation
                TagsBLL.Add(_context, data.title, (TagsBLL.Types)data.type, data.records, data.term);
            }

            return(Ok(new { status = "success", id = data.id, message = SiteConfig.generalLocalizer["_records_processed"].Value }));
        }
示例#2
0
        // GET: blogs/search
        public async Task <IActionResult> search(string term)
        {
            if (term == null)
            {
                return(Redirect("/blogs"));
            }

            var _sanitize = new HtmlSanitizer();

            term = _sanitize.Sanitize(UtilityBLL.ReplaceHyphinWithSpace(term));

            /* ***************************************/
            // Process Page Meta & BreaCrumb
            /* ***************************************/
            var _meta = PageMeta.returnPageMeta(new PageQuery()
            {
                controller = ControllerContext.ActionDescriptor.ControllerName,
                index      = ControllerContext.ActionDescriptor.ActionName,
                pagenumber = 1,
                matchterm  = term
            });

            if (Jugnoon.Settings.Configs.GeneralSettings.store_searches)
            {
                //*********************************************
                // User Search Tracking Script
                //********************************************
                if (!TagsBLL.Validate_Tags(term.Trim()) && !term.Trim().Contains("@"))
                {
                    // check if tag doesn't exist
                    var count_tags = await TagsBLL.Count(_context, new TagEntity()
                    {
                        type      = TagsBLL.Types.General,
                        tag_type  = TagsBLL.TagType.UserSearches,
                        isenabled = EnabledTypes.Enabled
                    });

                    if (count_tags == 0)
                    {
                        TagsBLL.Add(_context, term.Trim(), TagsBLL.Types.General, 0, TagsBLL.TagType.UserSearches, EnabledTypes.Enabled, term.Trim());
                    }
                }
            }

            /* List Initialization */
            var ListEntity = new BlogListViewModel()
            {
                QueryOptions = new BlogEntity()
                {
                    term = term,
                },
                BreadItems = _meta.BreadItems
            };


            return(View(ListEntity));
        }