public ActionResult _AjaxSave([DataSourceRequest] DataSourceRequest request, SearchModel item)
        {
            if (ModelState.IsValid)
            {
                SearchModel obj = _db.SearchModels.Find(item.ID);
                TryUpdateModel(obj);
                _db.Entry(obj).State = EntityState.Modified;
                _db.SaveChanges();

                CleanCache.CleanSearchModelCache();
            }

            return(Json(new[] { item }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult _AjaxDelete([DataSourceRequest] DataSourceRequest request, SearchModel item)
        {
            if (ModelState.IsValid)
            {
                SearchModel obj = _db.SearchModels.Find(item.ID);
                _db.Entry(obj).State = EntityState.Deleted;

                DeleteChildRows(obj.LangCode, obj.SearchSegmentName, obj.ID);
                _db.SaveChanges();

                CleanCache.CleanSearchModelCache();
            }

            return(Json(new[] { item }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult _AjaxInsert([DataSourceRequest] DataSourceRequest request, SearchModel item)
        {
            if (ModelState.IsValid)
            {
                SearchModel obj = item;
                if (TryUpdateModel(obj))
                {
                    _db.SearchModels.Add(obj);
                    _db.SaveChanges();

                    item.ID = obj.ID;
                    CleanCache.CleanSearchModelCache();
                }
            }

            return(Json(new[] { item }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult Index(int DDParent, string DDLangCode, string DDSegment, string SeachText)
        {
            if (!string.IsNullOrEmpty(SeachText))
            {
                foreach (string item in SeachText.Split('\n'))
                {
                    _db.SearchModels.Add(new SearchModel()
                    {
                        LangCode = DDLangCode, SearchSegmentName = DDSegment, ParentID = DDParent, Title = item.Trim().Replace("\r", "")
                    });
                }
                _db.SaveChanges();

                CleanCache.CleanSearchModelCache();
            }

            return(View());
        }